mozilla
Your Search Results

    Rebranding SpiderMonkey (1.8.5)

    After installing the build pre-requisites and downloading the SpiderMonkey source tarball issue the following commands at the terminal:

    cd js/src
    autoconf-2.13
    

    For the remainder of this document wherever you see the text $BRAND you will substitute that text with the name of your brand. For example the default brand for SpiderMonkey 1.8.5 is 'mozjs185'.

    mkdir build-$BRAND-release
    cd build-$BRAND-release

    Configure this build of SpiderMonkey with the desired options. For example:

    ../configure --enable-ctypes --with-system-nspr
    
    Note: Your desired configuration may be different. The only required part in this step is the ../configure command.

    So far, so good. Now for the tricky parts. We need to perform a recursive find and replace text operation on all files in the current directory. In the UNIX world we would issue the following command:

    find ./ -type f -exec sed -i "s/mozjs185/$BRAND/" {} \;
    
    Windows Users: Notepad++ can be used to perform the recursive find and replace text operation.
    If you have failed to insert your brand name in any of the previous steps where it is called for, you must delete this build directory and restart this process from the beginning. This time paying careful attention to the commands you issue to your command shell.

    The above command has actually changed some information we need changed back so we will re-issue the recursive find and replace text in files command with some modifications.

    find ./ -type f -exec sed -i "s/$BRAND.pc/mozjs185.pc/" {} \;
    

    The last recursive search and replace, changes the file name of the static library:

    find ./ -type f -exec sed -i "s/js_static/$BRAND_static/" {} \;
    

    Allright, almost there. Now comes the manual editing. Using your favorite editor open up the file named Makefile for editing. Search for this text: mozjs185.pc

    "Scroll down" a few lines until you see this line:

        > $@ && chmod 644 $@

    That line should be modified to read back:

        > $BRAND.pc &&

    chmod 644 $BRAND.pc

    "Scroll down" a few lines until you see these lines:

    install:: $(pkg_config_files)
        @echo pkg_config_file: $(pkg_config_files)

    Those two lines should be modified to read back:

    install:: $BRAND.pc
        @echo pkg_config_file: $BRAND.pc

    Note: While it is possible to automate the manual editing process, this has been discouraged due to the fact that these files are automatically generated and very little constant data can be depended upon. It also allows these instructions to apply to a wide range platforms without introducing more software dependencies.

    Save the file and exit the editor. You may now perform the build and installation of your custom branded SpiderMonkey library:

    make
    
    Note: Depending on your system you may need administrative rights to perform the installation:
    make install
    

    The following information isn't technically needed for using your library but it will help other applications use your library. Your rebranded library has been succesfully built and installed to libdir as specified in ./config/autoconf.mk. A pkgconfig file has also been installed for your library at libdir/pkgconfig/$BRAND.pc. You may wish to manually edit this file. It describes your library package.

    The script file js-config has not been modified either and still points to mozjs185. If this is not desirable, you can issue the following command on UNIX systems:

    sed -i "s/mozjs185/$BRAND/" /usr/bin/js-config
    

    Which performs a simple text replacement of mozjs185 with your branding on the js-config script. You may need administrative rights to run the above command.

    Document Tags and Contributors

    Contributors to this page: berkerpeksag, pc.wiz.tt, fscholz
    Last updated by: fscholz,