• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.reuse/H18-Sep-2021-2015

LICENSES/H03-May-2022-

build/H18-Sep-2021-11681

doc/H18-Sep-2021-3,0612,269

examples/H03-May-2022-10963

gi/H18-Sep-2021-20,46814,764

gjs/H18-Sep-2021-12,4388,523

installed-tests/H18-Sep-2021-3,1672,683

libgjs-private/H18-Sep-2021-1,008663

modules/H18-Sep-2021-4,3653,278

subprojects/H18-Sep-2021-6954

test/H18-Sep-2021-5,4874,266

tools/H18-Sep-2021-2,9392,170

util/H18-Sep-2021-631422

.clang-formatH A D18-Sep-2021929 3029

.editorconfigH A D18-Sep-2021345 1813

.eslintignoreH A D18-Sep-2021233 75

.eslintrc.ymlH A D18-Sep-20216.6 KiB264263

CONTRIBUTING.mdH A D18-Sep-202114.2 KiB345268

COPYINGH A D18-Sep-2021138 53

CPPLINT.cfgH A D18-Sep-2021678 1713

NEWSH A D18-Sep-2021122.3 KiB2,9072,362

README.MSVC.mdH A D18-Sep-20218.3 KiB161130

README.mdH A D18-Sep-20213.8 KiB9668

gjs.doapH A D18-Sep-20211.9 KiB5241

js.gresource.xmlH A D18-Sep-20212 KiB5742

jsconfig.jsonH A D18-Sep-202161 55

libgjs.mapH A D18-Sep-2021173 98

libgjs.symbolsH A D18-Sep-2021431 119

meson.buildH A D03-May-202227.2 KiB747642

README.MSVC.md

1Instructions for building GJS on Visual Studio or clang-cl
2==========================================================
3Building the GJS on Windows is now supported using Visual Studio
4versions 2019 or later with or without clang-cl in both 32-bit and
564-bit (x64) flavors, via Meson.  It should be noted that a
6recent-enough Windows SDK from Microsoft is still required if using
7clang-cl, as we will still use items from the Windows SDK.
8
9Recent official binary installers of CLang (which contains clang-cl)
10from the LLVM website are known to work to build SpiderMonkey 78 and
11GJS.
12
13You will need the following items to build GJS using Visual Studio
14or clang-cl (they can be built with Visual Studio 2015 or later,
15unless otherwise noted):
16-SpiderMonkey 78.x (mozjs-78). This must be built with clang-cl as
17 the Visual Studio  compiler is no longer supported for building this.
18 Please see the below section carefully on this...
19-GObject-Introspection (G-I) 1.61.2 or later
20-GLib 2.58.x or later, (which includes GIO, GObject, and the
21 associated tools)
22-Cairo including Cairo-GObject support (Optional)
23-GTK+-3.20.x or later (Optional)
24-and anything that the above items depend on.
25
26Note again that SpiderMonkey must be built using Visual Studio with
27clang-cl, and the rest should preferably be built with Visual Studio
28or clang-cl as well.  The Visual Studio version used for building the
29other dependencies should preferably be the same across the board, or,
30if using Visual Studio 2015 or later, Visual Studio 2015 through 2019.
31
32Please also be aware that the Rust MSVC toolchains that correspond to
33the platform you are building for must also be present to build
34SpiderMonkey.  Please refer to the Rust website on how to install the
35Rust compilers and toolchains for MSVC.  This applies to clang-cl
36builds as well.
37
38Be aware that it is often hard to find a suitable source release for
39SpiderMonkey nowadays, so it may be helpful to look in
40
41ftp://ftp.gnome.org/pub/gnome/teams/releng/tarballs-needing-help/mozjs/
42
43for the suitable release series of SpiderMonkey that corresponds to
44the GJS version that is being built, as GJS depends on ESR (Extended
45Service Release, a.k.a Long-term support) releases of SpiderMonkey.
46
47You may also be able to obtain the SpiderMonkey 78.x sources via the
48FireFox (ESR) or Thunderbird 78.x sources, in $(srcroot)/js.
49
50Please do note that the build must be done carefully, in addition to the
51official instructions that are posted on the Mozilla website:
52
53https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation
54
55For the configuration step, you will need to run the following:
56
57(64-bit/x64 builds)
58JS_STANDALONE=1 $(mozjs_srcroot)/js/src/configure --enable-nspr-build --host=x86_64-pc-mingw32 --target=x86_64-pc-mingw32 --prefix=<some_prefix> --disable-jemalloc --with-libclang-path=<full_path_to_directory_containing_libclang_dll> --with-clang-path=<full_path_to_directory_containing_clang_exe>
59
60(32-bit builds)
61JS_STANDALONE=1 $(mozjs_srcroot)/js/src/configure --enable-nspr-build --host=i686-pc-mingw32 --target=i686-pc-mingw32 --prefix=<some_prefix> --disable-jemalloc --with-libclang-path=<full_path_to_directory_containing_libclang_dll> --with-clang-path=<full_path_to_directory_containing_clang_exe>
62
63Notice that "JS_STANDALONE=1" and "--disable-jemalloc" are absolutely required,
64otherwise GJS will not build/run correctly.  If your GJS build crashes upon
65launch, use Dependency Walker to ensure that mozjs-78.dll does not depend on
66mozglue.dll!  If it does, or if GJS fails to link with missing arena_malloc() and
67friends symbols, you have built SpiderMoney incorrectly and will need to rebuild
68SpiderMonkey (with the build options as noted above) and retry the build.
69Note in particular that a mozglue.dll should *not* be in $(builddir)/dist/bin,
70although there will be a mozglue.lib somewhere in the build tree (which, you can
71safely delete after building SpiderMonkey).  The --host=... and --target=...
72are absolutely required for all builds, as per the Mozilla's SpiderMonkey build
73instructions, as Rust is being involved here.
74
75You may want to pass in --disable-js-shell to not build the JS
76shell that comes with SpiderMonkey to save time, and perhaps
77use --with-system-nspr (instead of the --enable-nspr-build as
78above), --with-system-zlib and --with-system-icu if you know
79what you are doing and that their pkg-config files
80(or headers/LIB's) can be found directly or using configuration
81options, to further save time.
82
83After the configuration finishes successfully, you may run 'mozmake' and
84'mozmake install' as you would for a standard SpiderMonkey build.  If
85'mozmake install' does not work for you for some reason, the DLLs you
86need and js.exe (if you did not pass in --disable-js-shell) can be
87found in $(buildroot)/dist/bin (you need *all* the DLLs, make sure
88that there is no mozglue.dll, otherwise you will need to redo your
89build as noted above), and the required headers are found in
90$(buildroot)/dist/include.  Note that for PDB files and .lib files,
91you will need to search for them in $(buildroot),
92where the PDB file names match the filenames for the DLLs/EXEs in
93$(buildroot)/dist/bin, and you will need to look for the following .lib files:
94-mozjs-78.lib
95-js_static.lib (optional)
96-nspr4.lib (optional, recommended for future use, if --enable-nspr-build is used)
97-plc4.lib (optional, recommended for future use, if --enable-nspr-build is used)
98-plds4.lib (optional, recommended for future use, if --enable-nspr-build is used)
99
100You may want to put the .lib's and DLLs/EXEs into $(PREFIX)\lib and
101$(PREFIX)\bin respectively, and put the headers into
102$(PREFIX)\include\mozjs-78 for convenience.
103
104You will need to place the generated mozjs-78.pc pkg-config file into
105$(PREFIX)\lib\pkgconfig and ensure that pkg-config can find it by
106setting PKG_CONFIG_PATH.  Ensure that the 'includedir' and 'libdir'
107in there is correct, and remove the 'nspr' entry from the
108'Requires.private:' line and change
109'-include ${includedir}/mozjs-78/js/RequiredDefines.h' to
110'-FI${includedir}/mozjs-78/js/RequiredDefines.h', so that the
111mozjs-78.pc can be used correctly in Visual Studio/clang-cl builds.  You
112will also need to ensure that the existing GObject-Introspection
113installation (if used) is on the same drive where the GJS sources
114are (and therefore where the GJS build is being carried out).
115
116Since Mozilla insisted that clang-cl is to be used to build SpiderMonkey,
117note that some SpideMonkey headers might need be updated as follows, if intending
118to build without clang-cl, since there are some GCC-ish assumptions here:
119
120-Update $(includedir)/mozjs-78/js/AllocPolicy.h (after the build):
121
122Get rid of the 'JS_FRIEND_API' macro from the class
123'TempAllocPolicy : public AllocPolicyBase' (ca. lines 112 and 178),
124for the member method definitions of onOutOfMemory() and reportAllocOverflow()
125
126-Update $(includedir)/mozjs-78/js/BigInt.h (after the build):
127
128Remove the 'JS_PUBLIC_API' macro from the definition of
129'template <typename NumericT>
130extern BigInt* NumberToBigInt(JSContext* cx, NumericT val)' (ca lines 72-73), as
131it should not be there.
132
133======================
134To carry out the build
135======================
136If using clang-cl, you will need to set *both* the environment variables CC
137and CXX to: 'clang-cl [--target=<target_triplet>]' (without the quotes); please
138see https://clang.llvm.org/docs/CrossCompilation.html on how the target triplet
139can be defined, which is used if using the cross-compilation capabilities of CLang.
140In this case, you need to ensure that 'clang-cl.exe' and 'lld-link.exe' (i.e. your
141LLVM bindir) are present in your PATH.
142
143You need to install Python 3.5.x or later, as well as the
144pkg-config tool, Meson (via pip) and Ninja.  Perform a build by doing the
145following, in an appropriate Visual Studio command prompt
146in an empty build directory:
147
148meson <path_to_gjs_sources> --buildtype=... --prefix=<some_prefix> -Dskip_dbus_tests=true
149
150(Note that -Dskip_dbus_tests=true is required for MSVC/clang-cl builds; please
151see the Meson documentation for the values accepted by buildtype)
152
153You may want to view the build options after the configuration succeeds
154by using 'meson configure'
155
156When the configuration succeeds, run:
157ninja
158
159You may choose to install the build results using 'ninja install'
160or running the 'install' project when the build succeeds.
161

README.md

1[![Build Status](https://gitlab.gnome.org/GNOME/gjs/badges/master/pipeline.svg)](https://gitlab.gnome.org/GNOME/gjs/pipelines)
2[![Coverage report](https://gitlab.gnome.org/GNOME/gjs/badges/master/coverage.svg)](https://gnome.pages.gitlab.gnome.org/gjs/)
3[![Contributors](https://img.shields.io/github/contributors/GNOME/gjs.svg)](https://gitlab.gnome.org/GNOME/gjs/-/graphs/HEAD)
4[![Last commit](https://img.shields.io/github/last-commit/GNOME/gjs.svg)](https://gitlab.gnome.org/GNOME/gjs/commits/HEAD)
5[![Search hit](https://img.shields.io/github/search/GNOME/gjs/goto.svg?label=github%20hits)](https://github.com/search?utf8=%E2%9C%93&q=gjs&type=)
6[![License](https://img.shields.io/badge/License-LGPL%20v2%2B-blue.svg)](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/COPYING)
7[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/COPYING)
8
9JavaScript bindings for GNOME
10=============================
11
12Use the GNOME platform libraries in your JavaScript programs.
13GJS powers GNOME Shell, Polari, GNOME Documents, and many other apps.
14Under the hood it uses SpiderMonkey, Mozilla's JavaScript engine
15originally developed for Firefox.
16
17## Installation
18
19Available as part of your GNOME distribution by default.
20In most package managers the package will be called `gjs`.
21
22## Usage
23
24GJS includes a command-line interpreter, usually installed in
25`/usr/bin/gjs`.
26Type `gjs` to start it and test out your JavaScript statements
27interactively.
28Hit Ctrl+D to exit.
29
30`gjs filename.js` runs a whole program.
31`gjs -d filename.js` does that and starts a debugger as well.
32
33There are also facilities for generating code coverage reports.
34Type `gjs --help` for more information.
35
36`-d` only available in gjs >= 1.53.90
37
38## Contributing
39
40For instructions on how to get started contributing to GJS, please read
41the contributing guide,
42<https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/CONTRIBUTING.md>.
43
44## History
45
46GJS probably started in August 2008 with [this blog post][havocp] and
47[this experimental code][gscript].
48GJS in its current form was first developed in October 2008 at a company
49called litl, for their [litl webbook] product.
50It was soon adopted as the basis of [GNOME Shell]'s UI code and
51extensions system and debuted as a fundamental component of GNOME 3.0.
52
53In February 2013 at the GNOME Developer Experience Hackfest GJS was
54declared the ['first among equals'][treitter] of languages for GNOME
55application development.
56That proved controversial for many, and was later abandoned.
57
58At the time of writing (2018) GJS is used in many systems including
59Endless OS's [framework for offline content][eos-knowledge-lib] and, as
60a forked version, [Cinnamon].
61
62## Reading material
63
64### Documentation
65
66* [Get started](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/CONTRIBUTING.md)
67* [Get started - Internship](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/doc/Internship-Getting-Started.md)
68* [API documentation](https://gjs-docs.gnome.org/)
69
70### JavaScript & SpiderMonkey
71
72* https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples
73
74### GNOME Contribution
75
76* https://wiki.gnome.org/GitLab
77* https://wiki.gnome.org/Newcomers/
78
79## License
80
81Dual licensed under LGPL 2.0+ and MIT.
82
83## Thanks ##
84
85The form of this README was inspired by [Nadia Odunayo][hospitable] on
86the Greater Than Code podcast.
87
88[havocp]: https://blog.ometer.com/2008/08/25/embeddable-languages/
89[gscript]: https://gitlab.gnome.org/Archive/gscript/tree/HEAD/gscript
90[litl webbook]: https://en.wikipedia.org/wiki/Litl
91[GNOME Shell]: https://wiki.gnome.org/Projects/GnomeShell
92[treitter]: https://treitter.livejournal.com/14871.html
93[eos-knowledge-lib]: http://endlessm.github.io/eos-knowledge-lib/
94[Cinnamon]: https://en.wikipedia.org/wiki/Cinnamon_(software)
95[hospitable]: https://www.greaterthancode.com/code-hospitality
96