source upload
This commit is contained in:
28
contrib/mORMot/SyNode/mozjs/BuildInstruction.md
Normal file
28
contrib/mORMot/SyNode/mozjs/BuildInstruction.md
Normal file
@@ -0,0 +1,28 @@
|
||||
<!-- Build instruction for SpiderMonkey45 for Windows to use with SyNode -->
|
||||
|
||||
##Preparation
|
||||
* Download and install **MozillaBuild**. See instruction here [MozillaBuild](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites#mozillabuild)
|
||||
|
||||
* Get Mozilla Source Code from here https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/45
|
||||
|
||||
* Apply patches.(todo: make patch)
|
||||
|
||||
## Build SpiderMonkey 45
|
||||
Follow instruction from [Mozilla Build Documentation](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation)
|
||||
The valid options for configure is:
|
||||
|
||||
../configure --enable-ctypes --disable-jemalloc
|
||||
|
||||
## Minimize a library size
|
||||
You can minimize a icu56 library size by customizing a languages included in the data file icudt56.dll
|
||||
|
||||
It can be done using [ICU Data Library Customizer](http://apps.icu-project.org/datacustom/ICUData56.html)
|
||||
|
||||
Use a Advanced Options in the bottom of page to filter and deselect intems you not required
|
||||
Our distribution include icudt56.dll WITHOUT
|
||||
- Urdu
|
||||
- Chinese
|
||||
- Japanese
|
||||
- Korean
|
||||
- Zulu
|
||||
- Vietnamese
|
86
contrib/mORMot/SyNode/mozjs/BuildInstructionSM52-linux.md
Normal file
86
contrib/mORMot/SyNode/mozjs/BuildInstructionSM52-linux.md
Normal file
@@ -0,0 +1,86 @@
|
||||
** CentOS / Ubuntu notes** If you need to use libmozjs-52 on bot CentOS / Ubuntu distribution we recommend to compile it on CentOS,
|
||||
because Ubintu 16.04 LTS have newer version of glibc (3.4.21)
|
||||
|
||||
Before proceeding Spider Monkey build pease consider reading general
|
||||
[Mozilla sources build instructuions](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions)
|
||||
and author's recommended approach to [build Spider Monkey](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation).
|
||||
|
||||
You may also find usefull following hiperlinks in the documents and read more about Mozilla sources in general.
|
||||
Basic knowledge of C/C++ language and linux build tools whould be helpfull when reading this documentation.
|
||||
|
||||
The "zero" step when building Mozilla sources is to prepare build box. Do this according to the
|
||||
[Mozilla Linux_Prerequisites documentation](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Linux_Prerequisites).
|
||||
It worth to note that this instruction has been checked against Ubuntu GNOME v16.04. You may find some differences building Mozilla sources on another version of Linux.
|
||||
|
||||
At the moment of writing this instruction there was no official release of Spider Monkey v52.
|
||||
At a later time you whould be able to find official sources of this version at [SpiderMonkey Releases page](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases).
|
||||
|
||||
Currently it is possible to download [nightly build from official repository](https://hg.mozilla.org/releases)
|
||||
or use source control tools to retrive sources from any of the Mozilla source control repositories.
|
||||
The author recommends to use git as a tool to take sources from GitHub.
|
||||
Issue the following command in a terminal window to clone GitHub repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/mozilla/gecko-dev.git
|
||||
```
|
||||
|
||||
Be prepared for long wait - cloning the repository may take up to half an hour or so depending on build box hardware and the Internet connection speed.
|
||||
This retrieves all Mozilla sources. A few different programs can be built using this sources like FireFox or Thunder Bird.
|
||||
But there is no way to retrive only part of the sources needed to build Spider Monkey only.
|
||||
Upon finish dive into the root sources directory and checkout branch esr52. Please note - you should _not_ use master branch to build Spider Monkey v52!
|
||||
|
||||
```bash
|
||||
cd gecko-dev
|
||||
git checkout esr52
|
||||
```
|
||||
|
||||
Now it's time to apply patch to the sources provided by SyNode:
|
||||
|
||||
```
|
||||
git apply <mORMot_sources_root>/SyNode/mozjs/esr52-git.patch
|
||||
```
|
||||
|
||||
Spider Monkey sources are located at "js\src":
|
||||
|
||||
```
|
||||
cd js/src
|
||||
```
|
||||
|
||||
Next run autoconfigure comand:
|
||||
|
||||
```
|
||||
autoconf2.13
|
||||
```
|
||||
|
||||
The next step is to crate the directory for build artifacts. It is recommended to use _OPT.OBJ directory for that (exact spelling),
|
||||
it's due to current state of .gitignore file.
|
||||
|
||||
```
|
||||
mkdir _OPT.OBJ
|
||||
cd _OPT.OBJ
|
||||
```
|
||||
|
||||
After that configure sources. This should be done by issuing the following command from the build artifacts directory:
|
||||
|
||||
```
|
||||
../configure --enable-ctypes --disable-jemalloc --enable-nspr-build --disable-debug-symbols
|
||||
```
|
||||
|
||||
The options stated should be used to successfully build and run SyNode.
|
||||
|
||||
And now run build itself:
|
||||
|
||||
```
|
||||
make
|
||||
```
|
||||
|
||||
Upon successfull build go to dist/bin subdirectory and take libmozjs-52.so library.
|
||||
To avoid conflicts with a packaged version of this library the name have to be changed, but issuing mv command to rename the file is not enough.
|
||||
Patchelf utility not less than version 0.9 should be used to change internal SONAME field:
|
||||
|
||||
```
|
||||
patchelf --set-soname libsynmozjs52.so libmozjs-52.so
|
||||
mv libmozjs-52.so libsynmozjs52.so
|
||||
```
|
||||
|
||||
It is recommended to copy resulting libsynmozjs52.so file to `/usr/lib` directory
|
81
contrib/mORMot/SyNode/mozjs/BuildInstructionSM52.md
Normal file
81
contrib/mORMot/SyNode/mozjs/BuildInstructionSM52.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# SpiderMonkey 52
|
||||
Main information about SpiderMonkey is [here](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey)
|
||||
|
||||
## Build instruction
|
||||
Official Mozilla instruction is [here](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation)
|
||||
Let's describe the details
|
||||
|
||||
### Preparing
|
||||
In first step you must install the next items:
|
||||
- Visual Studio(2013 for SpiderMonkey 45, or 2015 for SpiderMonkey 52).
|
||||
- [MozillaBuild](https://wiki.mozilla.org/MozillaBuild)
|
||||
- [Mercurial](https://www.mercurial-scm.org/downloads). At the moment of writing this instruction last version(4.1) could not download source code.
|
||||
The source code was downloaded by version 4.0
|
||||
|
||||
The next step is downloading SpiderMonkey source code:
|
||||
- *(recommended method)* Download from [official release page](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases).
|
||||
At the moment of writing this instruction, version 52 was absent in this page, so we could not use this method. But 45 version was present.
|
||||
- Download directly from [repository](https://hg.mozilla.org/releases) *(the version may be unstable)*. It is placed at folder `mozilla-esr<version_number>`
|
||||
|
||||
### Modification of SpiderMonkey source code for Delphi compability
|
||||
Our main task is to translate everything that will be imported to Delphi into `extern “C”` mode, and to write wrappers to things which cannot be translated
|
||||
|
||||
Usually it is enough to edit this files:
|
||||
- js\public\Initialization.h
|
||||
- js\src\jsfriendapi.h
|
||||
- js\src\jsapi.h
|
||||
|
||||
by adding `extern "C"` to functions that we need, and in files:
|
||||
- js\src\jsapi.h
|
||||
- js\src\jsapi.cpp
|
||||
|
||||
we must to write the wrappers to functions which we cannot import directly(that ones which use class instances).
|
||||
|
||||
For realization in Delphi we need to have an idea about internal structure of SpiderMonkey instances.
|
||||
The simplest way is to create C++ project in Visual Studio and run it in debug mode.
|
||||
Then we can create variables of unclear types and examine them in "Watch" window.
|
||||
Interesting for us information is `sizeof(variable)` and offset of addresses of fields of variables.
|
||||
This information is enough to understand structure.
|
||||
|
||||
For working with objects which allocated in stack we need to write wrappers, which works with `void*` type and apply `reinterpret_cast` to them
|
||||
|
||||
For SpiderMonkey 52 we created a patch `Delphi patch 52.patch` (for version from repository, *for version from release page it may be could not be applied)
|
||||
|
||||
### Building
|
||||
Then run MozillaBuild. It located in the directory where we install it (`C:\mozilla-build` by default). There are different *.bat files in this directory.
|
||||
For SpiderMonkey 45 we need `start-shell-msvc2013.bat`(for 32-bit version) or `start-shell-msvc2013-x64.bat`(for 64-bit version)
|
||||
For SpiderMonkey 52 we need `start-shell-msvc2015.bat`(for 32-bit version) or `start-shell-msvc2015-x64.bat`(for 64-bit version)
|
||||
Now we can see MozillaBuild console.
|
||||
Then we go to the source code folder(we downloaded them to `d:\mozilla-releases\mozilla-esr52` folder).
|
||||
|
||||
cd d:
|
||||
cd mozilla-releases\mozilla-esr52
|
||||
cd js\src
|
||||
|
||||
Then we recommend to create new folder for binary files location
|
||||
|
||||
mkdir obj
|
||||
cd obj
|
||||
|
||||
For 64-bit version we create `obj64` folder
|
||||
Then run build configurator:
|
||||
|
||||
../configure --enable-ctypes --disable-jemalloc [--disable-sm-promise]
|
||||
|
||||
For 64-bit version:
|
||||
|
||||
../configure --enable-ctypes --disable-jemalloc [--disable-sm-promise] --host=x86_64-pc-mingw32 --target=x86_64-pc-mingw32
|
||||
|
||||
`--enable-ctypes` activate [ctypes](https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes)(Mozilla realization of [ffi](https://github.com/ffi/ffi) in JS layer).
|
||||
|
||||
`--disable-jemalloc` deactivate jemalloc(memory manager). We use FastMM and if conflicts with jemalloc - there are AV on application exit.
|
||||
|
||||
`--disable-sm-promise` deactivate promises if you don't need them. At the moment of writing this instruction deactivation of promises fail build.
|
||||
If you not deactivate promises you must set promises callbacs `SetEnqueuePromiseJobCallback`, `SetGetIncumbentGlobalCallback` and `SetAsyncTaskCallbacks` else you get AV when work with promise.
|
||||
|
||||
Then we can run build
|
||||
|
||||
mozmake.exe
|
||||
|
||||
After successfully build binary files will be located in `dist\bin` folder. We need to take all `*.dll` from here.
|
||||
In order to be aligned with Linux version, the name of the mozjs-52.dll file should be changed to synmozjs52.dll
|
2542
contrib/mORMot/SyNode/mozjs/Delphi patch 52.patch
Normal file
2542
contrib/mORMot/SyNode/mozjs/Delphi patch 52.patch
Normal file
File diff suppressed because it is too large
Load Diff
2586
contrib/mORMot/SyNode/mozjs/esr52-git.patch
Normal file
2586
contrib/mORMot/SyNode/mozjs/esr52-git.patch
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user