{"id":15720302,"url":"https://github.com/gnome/gjs","last_synced_at":"2025-04-12T18:44:28.152Z","repository":{"id":3540870,"uuid":"4600883","full_name":"GNOME/gjs","owner":"GNOME","description":"Read-only mirror of https://gitlab.gnome.org/GNOME/gjs","archived":false,"fork":false,"pushed_at":"2025-03-29T21:32:53.000Z","size":16754,"stargazers_count":168,"open_issues_count":0,"forks_count":28,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-03T21:12:04.331Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gitlab.gnome.org/GNOME/gjs","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mgedmin/objgraph","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GNOME.png","metadata":{"files":{"readme":"README.MSVC.md","changelog":"NEWS","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-06-08T18:40:39.000Z","updated_at":"2025-03-29T21:32:59.000Z","dependencies_parsed_at":"2023-09-21T18:43:57.148Z","dependency_job_id":"b1e019a3-f78f-48e7-9d3a-6b033afad241","html_url":"https://github.com/GNOME/gjs","commit_stats":{"total_commits":4387,"total_committers":181,"mean_commits":24.23756906077348,"dds":0.6526099840437657,"last_synced_commit":"4c31b77f8a509d7586a0932552d74d9896b0b080"},"previous_names":[],"tags_count":220,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GNOME%2Fgjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GNOME%2Fgjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GNOME%2Fgjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GNOME%2Fgjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GNOME","download_url":"https://codeload.github.com/GNOME/gjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617199,"owners_count":21134190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T21:58:15.326Z","updated_at":"2025-04-12T18:44:28.108Z","avatar_url":"https://github.com/GNOME.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Instructions for building GJS on Visual Studio or clang-cl\r\n==========================================================\r\nBuilding the GJS on Windows is now supported using Visual Studio\r\nversions 2019 16.5.x or later with or without clang-cl in both 32-bit\r\nand 64-bit (x64) flavors, via Meson.  It should be noted that a\r\nrecent-enough Windows SDK from Microsoft is still required if using\r\nclang-cl, as we will still use items from the Windows SDK.\r\n\r\nRecent official binary installers of CLang (which contains clang-cl)\r\nfrom the LLVM website are known to work to build SpiderMonkey 128 and\r\nGJS.\r\n\r\nYou will need the following items to build GJS using Visual Studio\r\nor clang-cl (they can be built with Visual Studio 2015 or later,\r\nunless otherwise noted):\r\n- SpiderMonkey 128.x (mozjs-128). This must be built with clang-cl as\r\n  the Visual Studio  compiler is no longer supported for building this.\r\n  Please see the below section carefully on this...\r\n- GObject-Introspection (G-I) 1.66.x or later\r\n- GLib 2.66.x or later, (which includes GIO, GObject, and the\r\n  associated tools)\r\n- Cairo including Cairo-GObject support (Optional)\r\n- GTK+-4.x or later (Optional)\r\n- and anything that the above items depend on.\r\n\r\nNote again that SpiderMonkey must be built using Visual Studio with\r\nclang-cl, and the rest should preferably be built with Visual Studio\r\nor clang-cl as well.  The Visual Studio version used for building the\r\nother dependencies should preferably be the same across the board, or,\r\nif using Visual Studio 2015 or later, Visual Studio 2015 through 2022.\r\n\r\nPlease also be aware that the Rust MSVC toolchains that correspond to\r\nthe platform you are building for must also be present to build\r\nSpiderMonkey.  Please refer to the Rust website on how to install the\r\nRust compilers and toolchains for MSVC.  This applies to clang-cl\r\nbuilds as well.\r\n\r\nBe aware that it is often hard to find a suitable source release for\r\nSpiderMonkey nowadays, so it may be helpful to look in\r\n\r\nftp://ftp.gnome.org/pub/gnome/teams/releng/tarballs-needing-help/mozjs/\r\n\r\nfor the suitable release series of SpiderMonkey that corresponds to \r\nthe GJS version that is being built, as GJS depends on ESR (Extended \r\nService Release, a.k.a Long-term support) releases of SpiderMonkey.\r\n\r\nYou may also be able to obtain the SpiderMonkey 128.x sources via the\r\nFireFox (ESR) or Thunderbird 128.x sources, in $(srcroot)/js.\r\n\r\nPlease do note that the build must be done carefully, in addition to the\r\nofficial instructions that are posted on the Mozilla website:\r\n\r\nhttps://firefox-source-docs.mozilla.org/js/build.html\r\n\r\nYou will need to create a .mozconfig file that will describe your build\r\noptions for the build in the root directory of the Firefox/ThunderBird 128.x\r\nsources.  A sample content of the .mozconfig file can be added as follows:\r\n\r\n```\r\nac_add_options --enable-application=js\r\nmk_add_options MOZ_MAKE_FLAGS=-j12\r\nac_add_options --target=x86_64-pc-mingw32\r\nac_add_options --host=x86_64-pc-mingw32\r\nac_add_options --disable-tests\r\nac_add_options --enable-optimize\r\nac_add_options --disable-debug\r\nac_add_options --disable-jemalloc\r\nac_add_options --prefix=c:/software.b/mozjs128.bin\r\n```\r\n\r\nAn explanation of the lines above:\r\n*  `ac_add_options --enable-application=js`: This line is absolutely required, to build SpiderMonkey standalone\r\n*  `mk_add_options MOZ_MAKE_FLAGS=-j12`:  MOZ_MAKE_FLAGS=-jX means X number of parallel processes for the build\r\n*  `ac_add_options --target=x86_64-pc-mingw32`: Target architecture, replace `x86_64` with `aarch64` for ARM64 builds, and with `i686` for 32-bit x86 builds.\r\n*  `ac_add_options --host=x86_64-pc-mingw32`: Use this as-is, unless building on a 32-bit compiler (replace `x86_64` with `i686`; not recommended)\r\n*  `ac_add_options --disable-tests`: Save some build time\r\n*  `ac_add_options --enable-optimize`: Use for release builds of SpiderMonkey.  Use `--disable-optimize` instead if building with `--enable-debug`\r\n*  `ac_add_options --enable-debug`: Include debugging functions, for debug builds.  Use `--disable-debug` instead if building with `--enable-optimize`\r\n*  `ac_add_options --disable-jemalloc`: This is absolutely needed, otherwise GJS will not build and run correctly\r\n*  `ac_add_options --prefix=c:/software.b/mozjs128.bin`: Some installation path, change as needed\r\n\r\nIf your GJS build crashes upon launch, use Dependency Walker to ensure that\r\nmozjs-128.dll does not depend on mozglue.dll!  If it does, or if GJS fails to\r\nlink with missing arena_malloc() and friends symbols, you have built SpiderMoney\r\nincorrectly and will need to rebuild SpiderMonkey (with the build options as\r\nnoted above) and retry the build.\r\n\r\nPlease also check that `--enable-optimize` is *not* used with `--enable-debug`.\r\nYou should explicitly enable one and disable the other, as `--enable-debug`\r\nwill make the resulting build depend on the debug CRT, and mixing between\r\nthe release and debug CRT in the same DLL is often a sign of trouble when using\r\nwith GJS, meaning that you will need to rebuild SpiderMonkey with the appropriate\r\noptions set in your `.mozconfig` file.  Please note that for SpiderMonkey builds, \r\nPDB files are generated even if `--disable-debug` is used.\r\n\r\nYou will need to check that `js-config.h` has the correct entries that correspond\r\nto your SpiderMonkey build, especially the following items:\r\n\r\n*  `JS_64BIT`, `JS_PUNBOX64`: Should be defined for 64-bit builds, not 32-bit builds\r\n*  `JS_NUNBOX32`: Should be defined for 32-bit builds, not 64-bit builds\r\n*  `JS_DEBUG`, `JS_GC_ZEAL`: Should only be defined if `--enable-debug` is used\r\n\r\nNote in particular that a mozglue.dll should *not* be in $(builddir)/dist/bin,\r\nalthough there will be a mozglue.lib somewhere in the build tree (which, you can\r\nsafely delete after building SpiderMonkey).  The --host=... and --target=...\r\nare absolutely required for all builds, as per the Mozilla's SpiderMonkey build\r\ninstructions, as Rust is being involved here.\r\n\r\nRun `./mach build` to carry out the build, and then `./mach build install` to copy\r\nthe completed build to the directory specified by `ac_add_options --prefix=xxx`.\r\n\r\nIf `./mach build install` does not work for you for some reason, the DLLs you \r\nneed and js.exe can be found in $(buildroot)/dist/bin (you need *all* the DLLs,\r\nmake sure that there is no mozglue.dll, otherwise you will need to redo your \r\nbuild as noted above), and the required headers are found in\r\n$(buildroot)/dist/include.  Note that for PDB files and .lib files, \r\nyou will need to search for them in $(buildroot),\r\nwhere the PDB file names match the filenames for the DLLs/EXEs in\r\n$(buildroot)/dist/bin, and you will need to look for the following .lib files:\r\n-mozjs-128.lib\r\n-js_static.lib (optional)\r\n\r\nYou may want to put the .lib's and DLLs/EXEs into $(PREFIX)\\lib and \r\n$(PREFIX)\\bin respectively, and put the headers into\r\n$(PREFIX)\\include\\mozjs-128 for convenience.\r\n\r\nYou will need to place the generated mozjs-128.pc pkg-config file into\r\n$(PREFIX)\\lib\\pkgconfig and ensure that pkg-config can find it by\r\nsetting PKG_CONFIG_PATH.  Ensure that the 'includedir' and 'libdir'\r\nin there is correct so that the mozjs-128.pc can be used correctly in\r\nVisual Studio/clang-cl builds, and replace the `-isystem` with `-I` if\r\nbuilding GJS with Visual Studio.  You will also need to ensure that the\r\nexisting GObject-Introspection installation (if used) is on the same\r\ndrive where the GJS sources are (and therefore where the GJS build\r\nis being carried out).\r\n\r\nTo carry out the build\r\n======================\r\nIf using clang-cl, you will need to set *both* the environment variables CC\r\nand CXX to: 'clang-cl [--target=\u003ctarget_triplet\u003e]' (without the quotes); please\r\nsee https://clang.llvm.org/docs/CrossCompilation.html on how the target triplet\r\ncan be defined, which is used if using the cross-compilation capabilities of CLang.\r\nIn this case, you need to ensure that 'clang-cl.exe' and 'lld-link.exe' (i.e. your\r\nLLVM bindir) are present in your PATH.\r\n\r\nYou need to install Python 3.6.x or later, as well as the\r\npkg-config tool, Meson (via pip) and Ninja.  Perform a build by doing the\r\nfollowing, in an appropriate Visual Studio command prompt\r\nin an empty build directory:\r\n\r\n```\r\nmeson \u003cpath_to_gjs_sources\u003e --buildtype=... --prefix=\u003csome_prefix\u003e -Dskip_dbus_tests=true -Dprofiler=disabled\r\n```\r\n\r\n(Note that -Dskip_dbus_tests=true is required for MSVC/clang-cl builds; please\r\nsee the Meson documentation for the values accepted by buildtype)\r\n\r\nYou may want to view the build options after the configuration succeeds\r\nby using 'meson configure'.  You may need to set the envvar:\r\n`SETUPTOOLS_USE_DISTUTILS=stdlib` for the introspection step to proceed\r\nsuccessfully.  A fix for this is being investigated.\r\n\r\nWhen the configuration succeeds, run:\r\nninja\r\n\r\nYou may choose to install the build results using 'ninja install'\r\nor running the 'install' project when the build succeeds.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnome%2Fgjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnome%2Fgjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnome%2Fgjs/lists"}