[gjs/revert-072ffd6d] Revert "build: Remove Autotools build system"



commit d87010b7b36a17df5a9ab05fa62fc1e8dc21929e
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Nov 29 16:24:50 2019 +0000

    Revert "build: Remove Autotools build system"
    
    This reverts commit 072ffd6d7f184f35d953d5d0257c66a84c385458

 .gitlab-ci.yml                   |  61 ++++++
 AUTHORS                          |   0
 ChangeLog                        |   0
 Makefile-examples.am             |   6 +
 Makefile-insttest.am             |  65 +++++++
 Makefile-test.am                 | 354 ++++++++++++++++++++++++++++++++++
 Makefile.am                      | 272 ++++++++++++++++++++++++++
 README                           |   1 +
 autogen.sh                       |  33 ++++
 configure.ac                     | 403 +++++++++++++++++++++++++++++++++++++++
 git.mk                           | 359 ++++++++++++++++++++++++++++++++++
 gjs-1.0.pc.in                    |  18 ++
 gjs-modules-srcs.mk              |  34 ++++
 gjs-srcs.mk                      | 113 +++++++++++
 m4/code_coverage.m4              | 191 +++++++++++++++++++
 m4/extensions.m4                 | 183 ++++++++++++++++++
 m4/timer_time.m4                 |  44 +++++
 meson.build                      |  12 ++
 test/extra/do_environment.sh     |  13 ++
 test/test-ci.sh                  |  27 +++
 verbump.py                       |  47 +++++
 win32/Makefile.vc                |  66 +++++++
 win32/build-rules-msvc.mak       | 149 +++++++++++++++
 win32/config-msvc.mak            | 118 ++++++++++++
 win32/config.h.win32.in          |  92 +++++++++
 win32/create-lists-msvc.mak      | 107 +++++++++++
 win32/create-lists.bat           |  42 ++++
 win32/detectenv-msvc.mak         | 150 +++++++++++++++
 win32/generate-msvc.mak          |  24 +++
 win32/gjs-introspection-msvc.mak |  34 ++++
 win32/info-msvc.mak              |  93 +++++++++
 win32/install.mak                |  18 ++
 win32/introspection-msvc.mak     |  73 +++++++
 33 files changed, 3202 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b09863af..dd3a24bc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,8 @@ stages:
 - manual
 - deploy
 
+.Autotools files: &autotools_files  [configure, Makefile, ./*.log, ./*.trs, ./installed-tests/scripts/*.log, 
./installed-tests/scripts/*.trs]
+
 .coverage: &coverage
   image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs60
   variables:
@@ -27,6 +29,40 @@ stages:
       - _coverage/html
       - _coverage_build/meson-logs/*log.txt
 
+# Autotools build
+.autotools: &autotools
+  when: on_success
+  artifacts:
+    name: log
+    when: always
+    paths: &autotools_files
+
+  script:
+    # GitLab is keeping some files between jobs. Remove them.
+    - rm -rf configure Makefile *.log analysis
+
+    # Build GJS
+    - test/test-ci.sh GJS
+
+    # Run installed extra tests
+    - 'if [[ $BUILD_OPTS == *"--enable-installed-tests"* ]]; then
+         $(pwd)/test/test-ci.sh GJS_EXTRA;
+       fi
+    '
+
+    # Run valgrind
+    - 'if [[ $BUILD_OPTS == *"--enable-valgrind"* ]]; then
+         $(pwd)/test/test-ci.sh VALGRIND;
+       fi
+    '
+
+    # Run the script tests again (to assure they are working)
+    - 'if [[ -n "${SCRIPTCHECK}" ]]; then
+         $(pwd)/test/test-ci.sh SH_CHECKS;
+       fi
+    '
+
+# Meson build
 .build: &build
   when: on_success
   artifacts:
@@ -95,6 +131,20 @@ build_minimal:
   except:
     - schedules
 
+build_autotools:
+  <<: *autotools
+  stage: test
+  image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs60
+  variables:
+    TASK_ID: "fedora-x86_64-gcc-autotools-check"
+    BUILD_OPTS: >-
+      CPPFLAGS='-DGJS_VERBOSE_ENABLE_PROPS=1 -DGJS_VERBOSE_ENABLE_MARSHAL=1 -DGJS_VERBOSE_ENABLE_LIFECYCLE=1 
-DGJS_VERBOSE_ENABLE_GI_USAGE=1 -DGJS_VERBOSE_ENABLE_GCLOSURE=1 -DGJS_VERBOSE_ENABLE_GSIGNAL=1'
+      --with-cairo --enable-readline --enable-profiler
+      --enable-dtrace --enable-systemtap
+    TEST: check
+  except:
+    - schedules
+
 # Generates
 # The Code Coverage Report
 coverage-automatic:
@@ -223,6 +273,17 @@ sanitizer_clang:
   except:
     - schedules
 
+distcheck:
+  <<: *autotools
+  stage: manual
+  image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs60
+  variables:
+    TASK_ID: "fedora-x86_64-gcc-default-default-distcheck"
+    TEST: "distcheck"
+  when: manual
+  except:
+    - schedules
+
 installed_tests:
   <<: *build
   stage: manual
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..e69de29b
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 00000000..e69de29b
diff --git a/Makefile-examples.am b/Makefile-examples.am
new file mode 100644
index 00000000..43df2de5
--- /dev/null
+++ b/Makefile-examples.am
@@ -0,0 +1,6 @@
+EXTRA_DIST +=                                   \
+       examples/clutter.js                     \
+       examples/gio-cat.js                     \
+       examples/gtk.js                         \
+       examples/http-server.js                 \
+       examples/test.jpg
diff --git a/Makefile-insttest.am b/Makefile-insttest.am
new file mode 100644
index 00000000..7404d488
--- /dev/null
+++ b/Makefile-insttest.am
@@ -0,0 +1,65 @@
+EXTRA_DIST += \
+       installed-tests/debugger.test.in                \
+       installed-tests/minijasmine.test.in             \
+       installed-tests/script.test.in                  \
+       installed-tests/js/jsunit.gresources.xml        \
+       $(NULL)
+
+gjsinsttestdir = $(pkglibexecdir)/installed-tests
+installedtestmetadir = $(datadir)/installed-tests/gjs
+jstestsdir = $(gjsinsttestdir)/js
+jsscripttestsdir = $(gjsinsttestdir)/scripts
+debuggertestsdir = $(gjsinsttestdir)/debugger
+
+gjsinsttest_PROGRAMS = 
+gjsinsttest_DATA =
+gjsinsttest_SCRIPTS =
+installedtestmeta_DATA = 
+jstests_DATA =
+jsscripttests_DATA =
+debuggertests_DATA =
+pkglib_LTLIBRARIES =
+
+if BUILDOPT_INSTALL_TESTS
+
+gjsinsttest_PROGRAMS += minijasmine
+gjsinsttest_SCRIPTS += installed-tests/debugger-test.sh
+gjsinsttest_DATA += $(TEST_INTROSPECTION_TYPELIBS)
+installedtestmeta_DATA +=                      \
+       $(jasmine_tests:.js=.test)              \
+       $(simple_tests:%=%.test)                \
+       $(debugger_tests:.debugger=.test)       \
+       $(NULL)
+jstests_DATA += $(jasmine_tests)
+jsscripttests_DATA += $(simple_tests)
+debuggertests_DATA +=                  \
+       $(debugger_tests)               \
+       $(debugger_tests:%=%.js)        \
+       $(debugger_tests:%=%.output)    \
+       $(NULL)
+pkglib_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
+
+%.test: %.js installed-tests/minijasmine.test.in Makefile
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && \
+       $(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir),g \
+               -e s,@name\@,$(notdir $<), \
+               < $(srcdir)/installed-tests/minijasmine.test.in > $@.tmp && \
+       mv $@.tmp $@
+
+%.test: %.debugger installed-tests/debugger.test.in Makefile
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && \
+       $(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir),g \
+               -e s,@name\@,$(notdir $<), \
+               < $(srcdir)/installed-tests/debugger.test.in > $@.tmp && \
+       mv $@.tmp $@
+
+%.test: % installed-tests/script.test.in Makefile
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && \
+       $(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir), \
+               -e s,@name\@,$(notdir $<), \
+               < $(srcdir)/installed-tests/script.test.in > $@.tmp && \
+       mv $@.tmp $@
+
+CLEANFILES += $(installedtestmeta_DATA)
+
+endif BUILDOPT_INSTALL_TESTS
diff --git a/Makefile-test.am b/Makefile-test.am
new file mode 100644
index 00000000..89cb4d5b
--- /dev/null
+++ b/Makefile-test.am
@@ -0,0 +1,354 @@
+EXTRA_DIST +=                  \
+       test/test-bus.conf      \
+       test/run-test           \
+       $(NULL)
+
+### TEST RESOURCES #####################################################
+
+mock_js_resources_files := $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/test/mock-js-resources.gresource.xml)
+mock-js-resources.h: $(srcdir)/test/mock-js-resources.gresource.xml $(modules_resource_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name mock_js_resources $<
+mock-js-resources.c: $(srcdir)/test/mock-js-resources.gresource.xml $(modules_resource_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name mock_js_resources $<
+
+jsunit_resources_files := $(shell glib-compile-resources --sourcedir=$(srcdir)/installed-tests/js 
--generate-dependencies $(srcdir)/installed-tests/js/jsunit.gresources.xml)
+jsunit-resources.h: $(srcdir)/installed-tests/js/jsunit.gresources.xml $(jsunit_resources_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir)/installed-tests/js 
--sourcedir=$(builddir) --generate --c-name jsunit_resources $<
+jsunit-resources.c: $(srcdir)/installed-tests/js/jsunit.gresources.xml $(jsunit_resources_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir)/installed-tests/js 
--sourcedir=$(builddir) --generate --c-name jsunit_resources $<
+
+BUILT_SOURCES +=               \
+       mock-js-resources.c     \
+       mock-js-resources.h     \
+       jsunit-resources.c      \
+       jsunit-resources.h      \
+       $(NULL)
+
+EXTRA_DIST +=                                                  \
+       $(mock_js_resources_files)                              \
+       $(srcdir)/test/mock-js-resources.gresource.xml          \
+       $(jsunit_resources_files)                               \
+       $(NULL)
+
+CLEANFILES +=                                          \
+       mock-js-resources.c                             \
+       mock-js-resources.h                             \
+       jsunit-resources.c                              \
+       jsunit-resources.h                              \
+       $(NULL)
+
+gsettings_SCHEMAS = installed-tests/js/org.gnome.GjsTest.gschema.xml
+EXTRA_DIST += $(gsettings_SCHEMAS)
+@GSETTINGS_RULES@
+
+### TEST PROGRAMS ######################################################
+
+# gjs-tests.gtester checks private APIs and is run only uninstalled,
+# on "make check".
+#
+# jsunit checks public APIs using JS test scripts, and is run on "make check",
+# as well as installed if --enable-installed-tests is given at configure time.
+# See Makefile-insttest.am for the build rules installing the tests.
+
+check_PROGRAMS += gjs-tests.gtester minijasmine
+
+gjs_tests_gtester_CPPFLAGS =                   \
+       $(AM_CPPFLAGS)                          \
+       -DGJS_COMPILATION                       \
+       $(GJS_CFLAGS)                           \
+       $(gjs_directory_defines)                \
+       -I$(top_srcdir)/test
+
+gjs_tests_gtester_LDADD =      \
+       libgjs.la               \
+       libgjs-jsapi.la         \
+       $(GJS_LIBS)
+
+gjs_tests_gtester_SOURCES =                            \
+       test/gjs-tests.cpp                              \
+       test/gjs-test-common.cpp                        \
+       test/gjs-test-common.h                          \
+       test/gjs-test-utils.cpp                         \
+       test/gjs-test-utils.h                           \
+       test/gjs-test-call-args.cpp                     \
+       test/gjs-test-coverage.cpp                      \
+       test/gjs-test-rooting.cpp                       \
+       $(NULL)
+nodist_gjs_tests_gtester_SOURCES = mock-js-resources.c mock-js-resources.h
+
+minijasmine_SOURCES = installed-tests/minijasmine.cpp
+nodist_minijasmine_SOURCES = jsunit-resources.c jsunit-resources.h
+
+minijasmine_CPPFLAGS =                         \
+       $(AM_CPPFLAGS)                          \
+       $(GJS_CFLAGS)                           \
+       -I$(top_srcdir)                         \
+       -DINSTTESTDIR=\"$(gjsinsttestdir)\"     \
+       -DPKGLIBDIR=\"$(pkglibdir)\"            \
+       $(NULL)
+
+minijasmine_LDADD = $(GJS_LIBS) libgjs.la libgjs-jsapi.la
+
+### TEST GIRS ##########################################################
+
+TEST_INTROSPECTION_GIRS =
+common_test_ldflags = $(AM_LDFLAGS) -avoid-version
+common_test_libadd = $(GJS_LIBS)
+
+if !BUILDOPT_INSTALL_TESTS
+# This rpath /nowhere thing is the libtool upstream recommended way to
+# force generation of shared libraries, which we need in order for the
+# tests to work uninstalled.
+common_test_ldflags += -rpath /nowhere
+# In the installed tests case, these libraries are built for pkglibdir; sadly we
+# can only have one destination at a time
+check_LTLIBRARIES += libregress.la libwarnlib.la libgimarshallingtests.la
+endif
+
+# These sources are installed as part of gobject-introspection, and symlinked
+# into the build directory at configure time. They should not be distributed
+# with GJS.
+nodist_libregress_la_SOURCES =         \
+       installed-tests/regress.c       \
+       installed-tests/regress.h       \
+       $(NULL)
+libregress_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS) $(GJS_GDBUS_CFLAGS)
+libregress_la_LDFLAGS = $(common_test_ldflags) $(GJS_GDBUS_LIBS)
+libregress_la_LIBADD = $(common_test_libadd)
+libregress_scannerflags_includes = --include=Gio-2.0
+if ENABLE_CAIRO
+libregress_la_CPPFLAGS += $(GJS_CAIRO_CFLAGS)
+libregress_la_LDFLAGS +=  $(GJS_CAIRO_LIBS)
+libregress_scannerflags_includes += --include=cairo-1.0
+else
+libregress_la_CPPFLAGS += -D_GI_DISABLE_CAIRO
+endif
+Regress-1.0.gir: libregress.la
+Regress_1_0_gir_LIBS = libregress.la
+Regress_1_0_gir_FILES = $(nodist_libregress_la_SOURCES)
+Regress_1_0_gir_SCANNERFLAGS =                 \
+       --warn-all --warn-error                 \
+       $(libregress_scannerflags_includes)     \
+       $(WARN_SCANNERFLAGS)                    \
+       $(NULL)
+if !ENABLE_CAIRO
+Regress_1_0_gir_CFLAGS = -D_GI_DISABLE_CAIRO
+endif
+TEST_INTROSPECTION_GIRS += Regress-1.0.gir
+
+nodist_libwarnlib_la_SOURCES =         \
+       installed-tests/warnlib.c       \
+       installed-tests/warnlib.h       \
+       $(NULL)
+libwarnlib_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
+libwarnlib_la_LDFLAGS = $(common_test_ldflags)
+libwarnlib_la_LIBADD = $(common_test_libadd)
+WarnLib-1.0.gir: libwarnlib.la
+WarnLib_1_0_gir_LIBS = libwarnlib.la
+WarnLib_1_0_gir_INCLUDES = Gio-2.0
+WarnLib_1_0_gir_FILES = $(nodist_libwarnlib_la_SOURCES)
+WarnLib_1_0_gir_SCANNERFLAGS =         \
+       --c-include="warnlib.h"         \
+       --symbol-prefix=warnlib_        \
+       $(NULL)
+TEST_INTROSPECTION_GIRS += WarnLib-1.0.gir
+
+nodist_libgimarshallingtests_la_SOURCES =      \
+       installed-tests/gimarshallingtests.c    \
+       installed-tests/gimarshallingtests.h    \
+       $(NULL)
+libgimarshallingtests_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
+libgimarshallingtests_la_LDFLAGS = $(common_test_ldflags)
+libgimarshallingtests_la_LIBADD = $(common_test_libadd)
+GIMarshallingTests-1.0.gir: libgimarshallingtests.la
+GIMarshallingTests_1_0_gir_LIBS = libgimarshallingtests.la
+GIMarshallingTests_1_0_gir_INCLUDES = Gio-2.0
+GIMarshallingTests_1_0_gir_FILES = $(nodist_libgimarshallingtests_la_SOURCES)
+GIMarshallingTests_1_0_gir_SCANNERFLAGS =      \
+       --symbol-prefix=gi_marshalling_tests    \
+       --warn-all --warn-error                 \
+       $(WARN_SCANNERFLAGS)                    \
+       $(NULL)
+TEST_INTROSPECTION_GIRS += GIMarshallingTests-1.0.gir
+
+$(foreach gir,$(TEST_INTROSPECTION_GIRS),$(eval $(call introspection-scanner,$(gir))))
+TEST_INTROSPECTION_TYPELIBS = $(TEST_INTROSPECTION_GIRS:.gir=.typelib)
+noinst_DATA += $(TEST_INTROSPECTION_TYPELIBS)
+CLEANFILES += $(TEST_INTROSPECTION_GIRS) $(TEST_INTROSPECTION_TYPELIBS)
+
+### JAVASCRIPT TESTS ###################################################
+
+common_jstests_files =                                         \
+       installed-tests/js/testself.js                          \
+       installed-tests/js/testByteArray.js                     \
+       installed-tests/js/testExceptions.js                    \
+       installed-tests/js/testFormat.js                        \
+       installed-tests/js/testFundamental.js                   \
+       installed-tests/js/testGettext.js                       \
+       installed-tests/js/testGIMarshalling.js                 \
+       installed-tests/js/testGLib.js                          \
+       installed-tests/js/testGObject.js                       \
+       installed-tests/js/testGObjectClass.js                  \
+       installed-tests/js/testGObjectInterface.js              \
+       installed-tests/js/testGTypeClass.js                    \
+       installed-tests/js/testGio.js                           \
+       installed-tests/js/testImporter.js                      \
+       installed-tests/js/testIntrospection.js                 \
+       installed-tests/js/testLang.js                          \
+       installed-tests/js/testLegacyByteArray.js               \
+       installed-tests/js/testLegacyClass.js                   \
+       installed-tests/js/testLegacyGObject.js                 \
+       installed-tests/js/testLocale.js                        \
+       installed-tests/js/testMainloop.js                      \
+       installed-tests/js/testNamespace.js                     \
+       installed-tests/js/testPackage.js                       \
+       installed-tests/js/testParamSpec.js                     \
+       installed-tests/js/testRegress.js                       \
+       installed-tests/js/testSignals.js                       \
+       installed-tests/js/testSystem.js                        \
+       installed-tests/js/testTweener.js                       \
+       installed-tests/js/testWarnLib.js                       \
+       $(NULL)
+
+jasmine_tests = $(common_jstests_files)
+
+if DBUS_TESTS
+jasmine_tests += installed-tests/js/testGDBus.js
+endif
+
+if ENABLE_GTK
+jasmine_tests +=                                               \
+       installed-tests/js/testGtk.js                           \
+       installed-tests/js/testGObjectDestructionAccess.js      \
+       installed-tests/js/testLegacyGtk.js                     \
+       $(NULL)
+
+GTK_TESTS_ENVIRONMENT = export ENABLE_GTK=yes;
+else
+GTK_TESTS_ENVIRONMENT =
+endif
+
+if ENABLE_CAIRO
+jasmine_tests += installed-tests/js/testCairo.js
+endif
+
+EXTRA_DIST +=                                                  \
+       $(common_jstests_files)                                 \
+       installed-tests/js/testCairo.js                         \
+       installed-tests/js/testGtk.js                           \
+       installed-tests/js/testGDBus.js                         \
+       installed-tests/js/testGObjectDestructionAccess.js      \
+       installed-tests/js/testLegacyGtk.js                     \
+       installed-tests/extra/gjs.supp                          \
+       installed-tests/extra/lsan.supp                         \
+       $(NULL)
+
+### TEST EXECUTION #####################################################
+
+@VALGRIND_CHECK_RULES@
+VALGRIND_SUPPRESSIONS_FILES =                          \
+       $(datadir)/glib-2.0/valgrind/glib.supp          \
+       $(top_srcdir)/installed-tests/extra/gjs.supp    \
+       $(NULL)
+
+if DBUS_TESTS
+DBUS_SESSION_COMMAND = $(DBUS_RUN_SESSION) --config-file=$(srcdir)/test/test-bus.conf --
+else
+DBUS_SESSION_COMMAND =
+endif
+
+if CODE_COVERAGE_ENABLED
+COVERAGE_TESTS_ENVIRONMENT =                                           \
+       export GJS_UNIT_COVERAGE_OUTPUT=lcov;                           \
+       export GJS_UNIT_COVERAGE_PREFIX=resource:///org/gnome/gjs/;     \
+       $(NULL)
+else
+COVERAGE_TESTS_ENVIRONMENT =
+endif
+
+installed-tests/js/testGio.log: gschemas.compiled
+
+gschemas.compiled: installed-tests/js/org.gnome.GjsTest.gschema.xml
+       $(AM_V_GEN)$(GLIB_COMPILE_SCHEMAS) --targetdir=. $(<D)
+CLEANFILES += gschemas.compiled
+
+# GJS_PATH is empty here since we want to force the use of our own
+# resources. G_FILENAME_ENCODING ensures filenames are not UTF-8.
+AM_TESTS_ENVIRONMENT =                                 \
+       export TOP_BUILDDIR="$(abs_top_builddir)";      \
+       export GJS_USE_UNINSTALLED_FILES=1;             \
+       export GJS_PATH=;                               \
+       export GI_TYPELIB_PATH="$(builddir):$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}"; \
+       export LD_LIBRARY_PATH="$(builddir)/.libs:$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}"; \
+       export G_FILENAME_ENCODING=latin1;              \
+       export LSAN_OPTIONS="suppressions=$(abs_top_srcdir)/installed-tests/extra/lsan.supp"; \
+       export NO_AT_BRIDGE=1;                          \
+       export LC_ALL=$(TESTS_LOCALE);                  \
+       export GSETTINGS_SCHEMA_DIR="$(builddir)";      \
+       $(COVERAGE_TESTS_ENVIRONMENT)                   \
+       $(GTK_TESTS_ENVIRONMENT)                        \
+       $(DBUS_SESSION_COMMAND)                         \
+       $(NULL)
+
+simple_tests =                                         \
+       installed-tests/scripts/testCommandLine.sh      \
+       installed-tests/scripts/testWarnings.sh         \
+       $(NULL)
+EXTRA_DIST += $(simple_tests)
+
+debugger_tests =                                       \
+       installed-tests/debugger/backtrace.debugger     \
+       installed-tests/debugger/breakpoint.debugger    \
+       installed-tests/debugger/continue.debugger      \
+       installed-tests/debugger/delete.debugger        \
+       installed-tests/debugger/detach.debugger        \
+       installed-tests/debugger/down-up.debugger       \
+       installed-tests/debugger/finish.debugger        \
+       installed-tests/debugger/frame.debugger         \
+       installed-tests/debugger/keys.debugger          \
+       installed-tests/debugger/next.debugger          \
+       installed-tests/debugger/print.debugger         \
+       installed-tests/debugger/quit.debugger          \
+       installed-tests/debugger/return.debugger        \
+       installed-tests/debugger/set.debugger           \
+       installed-tests/debugger/step.debugger          \
+       installed-tests/debugger/throw.debugger         \
+       installed-tests/debugger/until.debugger         \
+       $(NULL)
+EXTRA_DIST +=                          \
+       $(debugger_tests)               \
+       $(debugger_tests:%=%.js)        \
+       $(debugger_tests:%=%.output)    \
+       $(NULL)
+
+TESTS =                                \
+       gjs-tests.gtester       \
+       $(simple_tests)         \
+       $(jasmine_tests)        \
+       $(debugger_tests)       \
+       $(NULL)
+
+TEST_EXTENSIONS = .gtester .sh .js .debugger
+
+LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
+
+GTESTER_LOG_DRIVER = $(LOG_DRIVER)
+GTESTER_LOG_COMPILER = $(top_srcdir)/test/run-test
+
+SH_LOG_DRIVER = $(LOG_DRIVER)
+
+JS_LOG_DRIVER = $(LOG_DRIVER)
+JS_LOG_COMPILER = $$LOG_COMPILER $$LOG_FLAGS $(top_builddir)/minijasmine
+
+DEBUGGER_LOG_DRIVER = $(LOG_DRIVER)
+DEBUGGER_LOG_COMPILER = $(top_srcdir)/installed-tests/debugger-test.sh
+EXTRA_DIST += installed-tests/debugger-test.sh
+
+CODE_COVERAGE_IGNORE_PATTERN = */{include,mfbt,gjs/test}/* *-resources.c
+CODE_COVERAGE_GENHTML_OPTIONS =                        \
+       $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)        \
+       lcov/coverage.lcov                              \
+       --prefix $(abs_top_builddir)/lcov/org/gnome/gjs \
+       --prefix $(abs_top_builddir)                    \
+       $(NULL)
+@CODE_COVERAGE_RULES@
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 00000000..412746ca
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,272 @@
+# http://people.gnome.org/~walters/docs/build-api.txt
+.buildapi-allow-builddir:
+
+-include $(INTROSPECTION_MAKEFILE)
+
+bin_PROGRAMS =
+lib_LTLIBRARIES =
+noinst_HEADERS =
+noinst_LTLIBRARIES =
+noinst_DATA =
+dist_gjsjs_DATA =
+BUILT_SOURCES =
+CLEANFILES =
+EXTRA_DIST =
+check_PROGRAMS =
+check_LTLIBRARIES =
+INTROSPECTION_GIRS =
+## ACLOCAL_AMFLAGS can be removed for Automake 1.13
+ACLOCAL_AMFLAGS = -I m4
+AM_CFLAGS = $(WARN_CFLAGS) $(CODE_COVERAGE_CFLAGS)
+AM_CXXFLAGS = $(WARN_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS)
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gjs\" $(CODE_COVERAGE_CPPFLAGS)
+AM_LDFLAGS = $(WARN_LDFLAGS) $(CODE_COVERAGE_LIBS)
+MAINTAINERCLEANFILES =                                 \
+       $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL)      \
+       $(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN)   \
+       $(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL)    \
+       tap-driver.sh                                   \
+       $(NULL)
+GITIGNOREFILES = INSTALL m4 tools/__pycache__
+
+gjsjsdir = @gjsjsdir@
+gjsoverridedir = $(gjsjsdir)/overrides
+
+gjs_public_includedir = $(includedir)/gjs-1.0
+
+########################################################################
+include gjs-srcs.mk
+include gjs-modules-srcs.mk
+########################################################################
+nobase_gjs_public_include_HEADERS = $(gjs_public_headers)
+
+########################################################################
+pkgconfig_DATA = gjs-1.0.pc
+
+EXTRA_DIST += gjs-1.0.pc.in
+
+valgrinddir = $(datadir)/gjs-1.0/valgrind
+dist_valgrind_DATA = installed-tests/extra/gjs.supp
+
+lsandir = $(datadir)/gjs-1.0/lsan
+dist_lsan_DATA = installed-tests/extra/lsan.supp
+
+########################################################################
+gjs_directory_defines =                                \
+       -DGJS_JS_DIR=\"$(gjsjsdir)\"                    \
+       -DPKGLIBDIR=\"$(pkglibdir)\"
+
+########################################################################
+noinst_LTLIBRARIES = libgjs-jsapi.la
+
+libgjs_jsapi_la_CPPFLAGS =     \
+       $(AM_CPPFLAGS)          \
+       $(GJS_CFLAGS)           \
+       $(gjs_directory_defines)\
+       -I$(top_srcdir)/gi      \
+       -DGJS_COMPILATION
+libgjs_jsapi_la_LDFLAGS =      \
+       $(AM_LDFLAGS)           \
+       $(NO_UNDEFINED_FLAG)    \
+       $(NULL)
+libgjs_jsapi_la_LIBADD =       \
+       $(GJS_LIBS)             \
+       $(NULL)
+
+libgjs_jsapi_la_SOURCES = $(gjs_jsapi_srcs)
+
+lib_LTLIBRARIES += libgjs.la
+
+libgjs_la_CPPFLAGS =           \
+       $(AM_CPPFLAGS)          \
+       $(GJS_CFLAGS)   \
+       -fvisibility=hidden     \
+       $(gjs_directory_defines)\
+       -I$(top_srcdir)/gi      \
+       -DGJS_COMPILATION
+libgjs_la_LDFLAGS =                    \
+       $(AM_LDFLAGS)                   \
+       -export-symbols-regex "^gjs_.*" \
+       -version-info 0:0:0             \
+       $(NO_UNDEFINED_FLAG)            \
+       $(NULL)
+libgjs_la_LIBADD =             \
+       $(GJS_LIBS)             \
+       libgjs-jsapi.la         \
+       $(READLINE_LIBS)        \
+       $(NULL)
+
+# Please see gjs-srcs.mk for brief expanations
+# of the layout of the sources due to historical
+# reasons
+libgjs_la_SOURCES = $(gjs_srcs)
+
+if ENABLE_PROFILER
+libgjs_la_CPPFLAGS += $(SYSPROF_CAPTURE_CFLAGS)
+libgjs_la_LIBADD += $(LIB_TIMER_TIME) $(SYSPROF_CAPTURE_LIBS)
+endif
+
+# Also, these files used to be a separate library
+libgjs_private_source_files = $(gjs_private_srcs)
+
+libgjs_la_SOURCES += $(libgjs_private_source_files)
+
+# The built-in modules also used to be compiled separately
+
+modules_resource_files := $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/modules/modules.gresource.xml)
+modules-resources.h: $(srcdir)/modules/modules.gresource.xml $(modules_resource_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name modules_resources $<
+modules-resources.c: $(srcdir)/modules/modules.gresource.xml $(modules_resource_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --sourcedir=$(builddir) 
--generate --c-name modules_resources $<
+
+EXTRA_DIST += $(modules_resource_files) $(srcdir)/modules/modules.gresource.xml
+
+modules_source_files =         \
+       $(module_system_srcs)   \
+       $(module_console_srcs)  \
+       $(NULL)
+
+if ENABLE_CAIRO
+modules_source_files += $(module_cairo_srcs)
+libgjs_la_CPPFLAGS += $(GJS_CAIRO_CFLAGS) $(GJS_CAIRO_XLIB_CFLAGS)
+libgjs_la_LIBADD += $(GJS_CAIRO_LIBS) $(GJS_CAIRO_XLIB_LIBS)
+endif
+
+CLEANFILES += $(module_resource_srcs)
+
+libgjs_la_SOURCES += $(modules_source_files)
+nodist_libgjs_la_SOURCES = $(module_resource_srcs)
+
+GjsPrivate-1.0.gir: libgjs.la
+GjsPrivate_1_0_gir_LIBS = libgjs.la
+GjsPrivate_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
+GjsPrivate_1_0_gir_CFLAGS = -I$(top_srcdir)
+GjsPrivate_1_0_gir_FILES = $(libgjs_private_source_files)
+GjsPrivate_1_0_gir_SCANNERFLAGS =      \
+       --identifier-prefix=Gjs         \
+       --symbol-prefix=gjs_            \
+       --warn-all                      \
+       $(WARN_SCANNERFLAGS)            \
+       $(NULL)
+
+INTROSPECTION_GIRS += GjsPrivate-1.0.gir
+
+if ENABLE_DTRACE
+gjs_gi_probes.h: gi/gjs_gi_probes.d
+       $(DTRACE) -C -h -s $< -o $@
+gjs_gi_probes.o: gi/gjs_gi_probes.d
+       $(DTRACE) -G -s $< -o $@
+BUILT_SOURCES += gjs_gi_probes.h gjs_gi_probes.o
+libgjs_la_LIBADD += gjs_gi_probes.o
+endif
+EXTRA_DIST += gi/gjs_gi_probes.d
+
+tapset_in_files = gjs/gjs.stp.in
+EXTRA_DIST += $(tapset_in_files)
+if ENABLE_SYSTEMTAP
+gjs/gjs.stp: gjs/gjs.stp.in Makefile
+       $(AM_V_GEN)$(MKDIR_P) $(@D) && \
+       $(SED) -e s,@EXPANDED_LIBDIR@,$(libdir), < $< > $@.tmp && mv $@.tmp $@
+tapsetdir   = $(datadir)/systemtap/tapset
+tapset_DATA = $(tapset_in_files:.stp.in=.stp)
+endif
+
+include Makefile-examples.am
+
+typelibdir = $(pkglibdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(INTROSPECTION_GIRS) $(typelib_DATA)
+
+########################################################################
+bin_PROGRAMS += gjs-console
+
+gjs_console_CPPFLAGS =                 \
+       $(AM_CPPFLAGS)          \
+       $(GJS_CONSOLE_CFLAGS)   \
+       $(NULL)
+gjs_console_LDADD =            \
+       $(GJS_CONSOLE_LIBS)     \
+       libgjs.la               \
+       libgjs-jsapi.la
+gjs_console_LDFLAGS = $(AM_LDFLAGS) -rdynamic
+gjs_console_SOURCES = $(gjs_console_srcs)
+
+install-exec-hook:
+       (cd $(DESTDIR)$(bindir) && $(LN_S) -f gjs-console$(EXEEXT) gjs$(EXEEXT))
+
+include Makefile-test.am
+include Makefile-insttest.am
+
+EXTRA_DIST +=                                  \
+       autogen.sh                              \
+       build/choose-tests-locale.sh            \
+       build/compile-gschemas.py               \
+       COPYING.LGPL                            \
+       doc/ByteArray.md                        \
+       doc/cairo.md                            \
+       doc/Hacking.md                          \
+       doc/SpiderMonkey_Memory.md              \
+       doc/Style_Guide.md                      \
+       installed-tests/js/meson.build          \
+       installed-tests/meson.build             \
+       libgjs.map                              \
+       libgjs.symbols                          \
+       meson.build                             \
+       meson_options.txt                       \
+       README.MSVC.md                          \
+       subprojects/glib.wrap                   \
+       subprojects/gobject-introspection.wrap  \
+       subprojects/libffi.wrap                 \
+       subprojects/proxy-libintl.wrap          \
+       subprojects/zlib.wrap                   \
+       test/meson.build                        \
+       win32/build-rules-msvc.mak              \
+       win32/config-msvc.mak                   \
+       win32/config.h.win32                    \
+       win32/create-lists-msvc.mak             \
+       win32/create-lists.bat                  \
+       win32/detectenv-msvc.mak                \
+       win32/generate-msvc.mak                 \
+       win32/gjs-introspection-msvc.mak        \
+       win32/info-msvc.mak                     \
+       win32/install.mak                       \
+       win32/introspection-msvc.mak            \
+       win32/Makefile.vc                       \
+       $(NULL)
+
+# Colin's handy Makefile bits for:
+# 1) stuffing tarballs with pre-generated scripts from your workstation
+# 2) bumping configure.ac version post-release
+# 3) tagging correctly in git
+# 4) uploading to gnome.org
+# To use:
+#  $ make check
+#  $ make dist
+#  $ make prepare-minor-release
+
+# Customize to taste
+TAG_PREFIX=GJS_
+COMPRESSION=.bz2
+
+DISTCLEANFILES=gjs-*.syscap
+
+PACKAGE=@PACKAGE@
+VERSION=@VERSION@
+DISTNAME=$(PACKAGE)-$(VERSION).tar$(COMPRESSION)
+TAG_VERSION := $(shell echo $(VERSION) | $(SED) s/\\\./_/g)
+
+prepare-release-tag: Makefile
+       git tag -m "Tag $(TAG_VERSION)" -a $(TAG_PREFIX)$(TAG_VERSION)
+
+prepare-minor-release: $(DISTNAME) prepare-release-tag Makefile
+       env top_srcdir=$(top_srcdir) python $(top_srcdir)/verbump.py
+
+upload-release: $(DISTNAME) Makefile
+       git log origin/master..master
+       @echo -n "Ok to push? [y/N] "; read ans; test x$$ans == xy || exit 1
+       git push --tags origin master:master
+       scp $(DISTNAME) master.gnome.org:
+       ssh master.gnome.org install-module $(DISTNAME)
+
+-include $(top_srcdir)/git.mk
diff --git a/README b/README
new file mode 120000
index 00000000..42061c01
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+README.md
\ No newline at end of file
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 00000000..8c1e233b
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -z "$srcdir" && srcdir=.
+olddir=`pwd`
+cd "$srcdir"
+
+(test -f configure.ac) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level directory"
+    exit 1
+}
+
+if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
+    echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
+    echo "*** If you wish to pass any to it, please specify them on the" >&2
+    echo "*** '$0' command line." >&2
+    echo "" >&2
+fi
+
+aclocal --install || exit 1  # autoreconf will do this automatically in future
+autoreconf --verbose --force --install || exit 1
+
+cd "$olddir"
+if [ "$NOCONFIGURE" = "" ]; then
+    "$srcdir/configure" "$@" || exit 1
+
+    if [ "$1" = "--help" ]; then exit 0 else
+        echo "Now type 'make' to compile" || exit 1
+    fi
+else
+    echo "Skipping configure process."
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 00000000..dfd59b7e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,403 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+m4_define(pkg_major_version, 1)
+m4_define(pkg_minor_version, 63)
+m4_define(pkg_micro_version, 3)
+m4_define(pkg_version, pkg_major_version.pkg_minor_version.pkg_micro_version)
+m4_define(pkg_int_version, (pkg_major_version * 100 + pkg_minor_version) * 100 + pkg_micro_version)
+
+AC_PREREQ([2.64])
+AC_INIT([gjs],[pkg_version],[https://gitlab.gnome.org/GNOME/gjs/issues],[gjs],[https://wiki.gnome.org/Projects/Gjs])
+AM_INIT_AUTOMAKE([1.11.1 subdir-objects dist-xz no-dist-gzip tar-ustar -Wno-portability])
+AX_IS_RELEASE([git-directory])
+AC_CONFIG_SRCDIR([gjs/console.cpp])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_HEADERS([config.h])
+AC_REQUIRE_AUX_FILE([tap-driver.sh])
+
+AC_SUBST(GJS_VERSION, m4_eval(pkg_int_version))
+AC_DEFINE([GJS_VERSION], pkg_int_version, [The gjs version as an integer])
+
+AM_MAINTAINER_MODE([enable])
+AM_SILENT_RULES([yes])
+
+# our first pkg-config invocation is conditional, ensure macros still work
+PKG_PROG_PKG_CONFIG
+PKG_INSTALLDIR
+
+AC_PROG_CC
+AC_PROG_CC_C99
+
+AC_LANG([C++])
+AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_CXX
+AX_CXX_COMPILE_STDCXX_14
+AC_CHECK_HEADERS([sys/signal.h sys/syscall.h unistd.h])
+
+LT_PREREQ([2.2.0])
+# no stupid static libraries
+LT_INIT([disable-static])
+
+# Other programs
+AC_PROG_MKDIR_P
+AC_PROG_LN_S
+AC_PROG_SED
+AC_PROG_AWK
+GLIB_GSETTINGS
+
+AX_COMPILER_FLAGS
+
+GJS_CODE_COVERAGE
+dnl Clang does not need to link with -lgcov
+AX_CHECK_LINK_FLAG([-lgcov],, [
+       CODE_COVERAGE_LIBS=
+       CODE_COVERAGE_LDFLAGS=
+])
+
+AX_VALGRIND_DFLT([drd], [off])
+AX_VALGRIND_DFLT([sgcheck], [off])
+# DRD and sgcheck don't produce useful diagnostics at this time
+AX_VALGRIND_CHECK
+
+# Checks for libraries.
+m4_define(glib_required_version, 2.58.0)
+
+GOBJECT_INTROSPECTION_REQUIRE([1.61.2])
+
+GLIB_REQUIREMENT="glib-2.0 >= glib_required_version"
+GOBJECT_REQUIREMENT="gobject-2.0 >= glib_required_version"
+GIO_REQUIREMENT="gio-2.0 >= glib_required_version"
+gjs_base_packages="$GOBJECT_REQUIREMENT gio-2.0"
+common_packages="gthread-2.0 $GIO_REQUIREMENT mozjs-60"
+gjs_packages="gobject-introspection-1.0 libffi $common_packages"
+gjs_cairo_packages="cairo cairo-gobject $common_packages"
+gjs_sysprof_packages="sysprof-capture-3 >= 3.33.2"
+
+AX_PKG_CHECK_MODULES([GJS],
+  [$GLIB_REQUIREMENT $GOBJECT_REQUIREMENT $GIO_REQUIREMENT],
+  [$gjs_packages])
+dnl These don't need to be put in the .pc file so use regular PKG_CHECK_MODULES
+PKG_CHECK_MODULES([GJS_GDBUS], [$gjs_base_packages])
+PKG_CHECK_MODULES([GJS_CONSOLE], [$gjs_base_packages])
+
+CPPFLAGS_save="$CPPFLAGS"
+CPPFLAGS="$GJS_CFLAGS"
+LIBS_save="$LIBS"
+LIBS="$GJS_LIBS"
+
+dnl If SpiderMonkey was compiled with --enable-debug, then we need to define
+dnl -DDEBUG before including js-config.h.
+AC_MSG_CHECKING([whether SpiderMonkey was configured with --enable-debug])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <js-config.h>
+#ifdef JS_DEBUG
+#error debug yes, if we did not already error out due to DEBUG not being defined
+#endif
+]])], [
+  AC_MSG_RESULT([no])
+  GJS_DEBUG_DEF=
+], [
+  AC_DEFINE([HAVE_DEBUG_SPIDERMONKEY], [1],
+    [Define to 1 if SpiderMonkey was compiled with --enable-debug])
+  GJS_DEBUG_DEF='#define DEBUG 1'
+  AC_MSG_RESULT([yes])
+])
+
+# Sanity check for SpiderMonkey
+AC_MSG_CHECKING([if a minimal SpiderMonkey program compiles and runs])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([
+$GJS_DEBUG_DEF
+#include <js/Initialization.h>
+  ], [
+if (!JS_Init()) exit(1);
+JS_ShutDown();
+  ])],
+  [AC_MSG_RESULT([yes])],
+  [AC_MSG_RESULT([no])
+    AC_MSG_ERROR([Check if you are using the recommended configuration for
+SpiderMonkey. See the file org.gnome.Sdk.json.in in
+https://gitlab.gnome.org/GNOME/gnome-sdk-images])],
+  [AC_MSG_RESULT([cross-compiling, unable to determine])])
+
+LIBS="$LIBS_save"
+CPPFLAGS="$CPPFLAGS_save"
+
+# Optional cairo dep (enabled by default)
+AC_ARG_WITH(cairo,
+  [AS_HELP_STRING([--without-cairo], [Don't build cairo module])])
+AS_IF([test "x$with_cairo" != "xno"],
+  [AX_PKG_CHECK_MODULES([GJS_CAIRO], [], [$gjs_cairo_packages],
+    [have_cairo=yes], [have_cairo=no])],
+  [have_cairo=no])
+AM_CONDITIONAL(ENABLE_CAIRO, test x$have_cairo = xyes)
+AS_IF([test x$have_cairo = xyes], [
+  AC_DEFINE([ENABLE_CAIRO],[1],[Define if you want to build with cairo support])
+  AX_PKG_CHECK_MODULES([GJS_CAIRO_XLIB], [], [cairo-xlib], [],
+    [AC_MSG_WARN([Cairo-xlib support not found])])
+], [AS_IF([test "x$with_cairo" = "xyes"],
+  [AC_MSG_ERROR([Cairo requested but not found])])])
+
+# Optional GTK+ dep (enabled by default)
+AC_ARG_WITH(gtk-tests,
+  [AS_HELP_STRING([--without-gtk-tests], [Skip tests that need a display connection])])
+AM_CONDITIONAL(ENABLE_GTK, [test "x$with_gtk_tests" != "xno"])
+
+AC_ARG_ENABLE([profiler],
+  [AS_HELP_STRING([--disable-profiler], [Don't build profiler])],
+  [],
+  [enable_profiler=auto])
+
+# Use sysprof-capture-3 for profiler
+PKG_CHECK_MODULES([SYSPROF_CAPTURE],
+                  [$gjs_sysprof_packages],
+                  [have_sysprof_capture=yes],
+                  [have_sysprof_capture=no])
+AC_SUBST([SYSPROF_CAPTURE_CFLAGS])
+AC_SUBST([SYSPROF_CAPTURE_LIBS])
+
+AS_IF([test x$enable_profiler = xauto],[
+  AS_IF([test $have_sysprof_capture = no],[enable_profiler=no])
+])
+AS_IF([test x$enable_profiler = xyes],[
+  AS_IF([test $have_sysprof_capture = no],[
+    AC_MSG_ERROR([--enable-profiler requires sysprof-capture-3.pc])
+  ])
+])
+
+# Some Linux APIs required for profiler
+AS_IF([test x$enable_profiler != xno], [
+  # Requires timer_settime() - only on Linux
+  gl_TIMER_TIME
+  # Requires SIGEV_THREAD_ID - not in some stdlibs
+  have_sigev_thread_id=no
+  AC_MSG_CHECKING([for Linux SIGEV_THREAD_ID])
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([[#include <signal.h>]], [return SIGEV_THREAD_ID;])
+  ], [
+    have_sigev_thread_id=yes
+    AC_MSG_RESULT([yes])
+  ], [AC_MSG_RESULT([no])])
+  AS_IF([test x$ac_cv_func_timer_settime = xno -o x$have_sigev_thread_id = xno],
+    AS_IF([test x$enable_profiler = xyes],
+          [AC_MSG_ERROR([The profiler is currently only supported on Linux.
+The standard library must support timer_settime() and SIGEV_THREAD_ID.
+Configure with --disable-profiler to skip it on other platforms.])],
+          [enable_profiler=no]))
+  AS_IF([test x$enable_profiler = xauto],[enable_profiler=yes])
+  AC_DEFINE([ENABLE_PROFILER], [test x$enable_profiler = xyes], [Define if the profiler should be built.])
+])
+
+AM_CONDITIONAL([ENABLE_PROFILER], [test x$enable_profiler != xno])
+
+# Optional redline dep (enabled by default)
+AC_ARG_ENABLE([readline],
+  [AS_HELP_STRING([--disable-readline], [Don't build readline-related code @<:@default=no@:>@])])
+
+PKG_CHECK_VAR([GI_DATADIR], [gobject-introspection-1.0], [gidatadir])
+
+# readline
+LIBS_no_readline=$LIBS
+
+AS_IF([test x$enable_readline != xno],[
+
+  # On some systems we need to link readline to a termcap compatible
+  # library.
+  gjs_cv_lib_readline=no
+  AC_MSG_CHECKING([how to link readline libs])
+  for gjs_libtermcap in "" ncursesw ncurses curses termcap; do
+    if test -z "$gjs_libtermcap"; then
+      READLINE_LIBS="-lreadline"
+    else
+      READLINE_LIBS="-lreadline -l$gjs_libtermcap"
+    fi
+    LIBS="$READLINE_LIBS $LIBS_no_readline"
+    AC_LINK_IFELSE(
+      [AC_LANG_CALL([],[readline])],
+      [gjs_cv_lib_readline=yes])
+    if test $gjs_cv_lib_readline = yes; then
+      break
+    fi
+  done
+],[gjs_cv_lib_readline=no])
+
+if test $gjs_cv_lib_readline = no; then
+  AS_IF([test x$enable_readline != xno],
+    [AC_MSG_ERROR([Readline requested but not found. Configure with --disable-readline.])])
+  READLINE_LIBS=""
+  ac_cv_header_readline_readline_h=no
+else
+  AC_MSG_RESULT([$READLINE_LIBS])
+  AC_CHECK_HEADERS([readline/readline.h])
+fi
+
+AC_SUBST([READLINE_LIBS])
+
+# End of readline checks: restore LIBS
+LIBS=$LIBS_no_readline
+
+AC_MSG_CHECKING([whether printf() accepts '%Id' for alternative integer output])
+CXXFLAGS_save="$CXXFLAGS"
+CXXFLAGS="-Werror -Wformat -pedantic-errors"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
+  [[printf("%Id", (int)0);]])], [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE([HAVE_PRINTF_ALTERNATIVE_INT], [1],
+      [Define to 1 if printf() accepts '%Id' for alternative integer output])
+  ],
+  [AC_MSG_RESULT([no])])
+CXXFLAGS="$CXXFLAGS_save"
+
+AC_ARG_ENABLE(installed_tests,
+  [AS_HELP_STRING([--enable-installed-tests],
+    [Install test programs @<:@default: no@:>@])])
+AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
+
+dnl
+dnl Tracing
+dnl
+
+AC_ARG_ENABLE([dtrace],
+  [AS_HELP_STRING([--enable-dtrace],
+    [Include dtrace trace support @<:@default: no@:>@])])
+
+AC_ARG_ENABLE([systemtap],
+  [AS_HELP_STRING([--enable-systemtap],
+    [Include systemtap trace support (implies --enable-dtrace) @<:@default: no@:>@])])
+AS_IF([test "x$enable_systemtap" = "xyes"], [enable_dtrace=yes])
+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test "x$enable_systemtap" = "xyes"])
+
+AS_IF([test "x$enable_dtrace" = "xyes"], [
+  AC_PATH_PROG([DTRACE], [dtrace])
+  AS_IF([test -z "$DTRACE"],
+    [AC_MSG_ERROR([dtrace is required for --enable-dtrace or --enable-systemtap])])
+  AC_CHECK_HEADER([sys/sdt.h],,
+    [AC_MSG_ERROR([sys/sdt.h header is required for --enable-dtrace or --enable-systemtap])])
+  AC_DEFINE([HAVE_DTRACE], [1], [Define to 1 if using dtrace probes.])
+])
+AM_CONDITIONAL([ENABLE_DTRACE], [test "x$enable_dtrace" = "xyes"])
+
+dnl
+dnl Check for -Bsymbolic-functions linker flag used to avoid
+dnl intra-library PLT jumps, if available.
+dnl
+AC_ARG_ENABLE([Bsymbolic],
+  [AS_HELP_STRING([--disable-Bsymbolic], [avoid linking with -Bsymbolic])])
+AS_IF([test "x$enable_Bsymbolic" != "xno"],
+  [AX_APPEND_LINK_FLAGS([-Bsymbolic-functions])])
+
+dnl
+dnl Check for sanitizer support
+dnl
+AC_ARG_ENABLE([asan],
+  [AS_HELP_STRING([--enable-asan], [Build with address sanitizer support @<:@default: no@:>@])])
+
+AS_IF([test "x$enable_asan" = "xyes"], [
+  AX_CHECK_COMPILE_FLAG([-fsanitize=address -fno-omit-frame-pointer -g], [
+    AX_CHECK_LINK_FLAG([-fsanitize=address])
+    SAN_FLAGS="-fsanitize=address"
+  ])
+])
+
+AC_ARG_ENABLE([ubsan],
+  [AS_HELP_STRING([--enable-ubsan], [Build with undefined behavior and integer overflow sanitizer support 
@<:@default: no@:>@])])
+
+AS_IF([test "x$enable_ubsan" = "xyes"], [
+  AX_CHECK_COMPILE_FLAG([-fsanitize=undefined -fsanitize=integer -fno-sanitize=vptr -fno-omit-frame-pointer 
-g], [
+    AX_CHECK_LINK_FLAG([-fsanitize=undefined -fsanitize=integer -fno-sanitize=vptr])
+    SAN_FLAGS="$SAN_FLAGS -fsanitize=undefined -fsanitize=integer -fno-sanitize=vptr"
+  ])
+])
+
+# According to https://github.com/google/sanitizers/issues/380, asan is not
+# compatible with -no-undefined.
+NO_UNDEFINED_FLAG=-no-undefined
+AS_IF([test -n "${SAN_FLAGS}"], [
+    GJS_CFLAGS="$GJS_CFLAGS $SAN_FLAGS -fno-omit-frame-pointer -g"
+    # We have to clobber LDFLAGS here and not use AM_LDFLAGS, or else
+    # g-ir-scanner will not pick it up.
+    LDFLAGS="$LDFLAGS $SAN_FLAGS"
+    NO_UNDEFINED_FLAG=
+])
+AC_SUBST([NO_UNDEFINED_FLAG])
+
+# This is needed (at least) for clang on Ubuntu PIC (Position-Independent Code)
+AX_APPEND_COMPILE_FLAGS([$lt_prog_compiler_pic], [CXXFLAGS])
+AX_APPEND_COMPILE_FLAGS([$lt_prog_compiler_pic], [CFLAGS])
+AX_APPEND_LINK_FLAGS([$lt_prog_compiler_pic])
+
+dnl If SpiderMonkey was compiled with this configure option, then GJS needs to
+dnl be compiled with it as well, because we inherit from a SpiderMonkey class in
+dnl context.cpp. See build/autoconf/compiler-opts.m4 in mozjs52.
+AC_ARG_ENABLE([cpp-rtti],
+  [AS_HELP_STRING([--enable-cpp-rtti],
+    [needs to match SpiderMonkey's config option @<:@default=off@:>@])])
+AS_IF([test "x$enable_cpp_rtti" != "xyes"],
+  [AX_APPEND_COMPILE_FLAGS([-fno-rtti])],
+  [AX_APPEND_COMPILE_FLAGS([-GR-])])
+
+AC_ARG_WITH([dbus-tests],
+  [AS_HELP_STRING([--without-dbus-tests],
+    [Don't try to use DBus during make check @<:@default=use@:>@])])
+AS_IF([test "x$with_dbus_tests" != "xno"], [
+  AC_PATH_PROG([DBUS_RUN_SESSION], [dbus-run-session])
+  AS_IF([test -z "$DBUS_RUN_SESSION"],
+    [AC_MSG_ERROR([dbus-run-session is required for --with-dbus-tests])])
+])
+AM_CONDITIONAL([DBUS_TESTS], [test "x$with_dbus_tests" != "xno"])
+
+AC_MSG_CHECKING([for a suitable UTF-8 locale to run the tests in])
+TESTS_LOCALE=$($srcdir/build/choose-tests-locale.sh)
+AC_MSG_RESULT([$TESTS_LOCALE])
+AC_SUBST([TESTS_LOCALE])
+
+AC_SUBST([gjsjsdir], [\${datadir}/gjs-1.0])
+
+dnl automake 1.11/1.12 defines this but does not substitute it
+AC_SUBST([pkglibexecdir], ["${libexecdir}/${PACKAGE}"])
+
+AC_CONFIG_FILES([Makefile gjs-1.0.pc win32/config.h.win32])
+dnl Symlink the files from gobject-introspection's test libraries into the tree;
+dnl Automake plans to drop support for compiling them in-place.
+AC_CONFIG_LINKS([
+  installed-tests/gitestmacros.h:$GI_DATADIR/tests/gitestmacros.h
+  installed-tests/regress.c:$GI_DATADIR/tests/regress.c
+  installed-tests/regress.h:$GI_DATADIR/tests/regress.h
+  installed-tests/warnlib.c:$GI_DATADIR/tests/warnlib.c
+  installed-tests/warnlib.h:$GI_DATADIR/tests/warnlib.h
+  installed-tests/gimarshallingtests.c:$GI_DATADIR/tests/gimarshallingtests.c
+  installed-tests/gimarshallingtests.h:$GI_DATADIR/tests/gimarshallingtests.h
+])
+AC_OUTPUT
+
+# Warn about conditions that affect runtime
+PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 1.61.2], [], [
+    AC_MSG_WARN([You do not have a new enough version of
+gobject-introspection to run the tests. You can still build GJS, but some
+tests will fail.])])
+
+AS_IF([test "$TESTS_LOCALE" = "C"], [
+  AC_MSG_WARN([Your libc does not have the C.UTF-8 locale and no other
+suitable UTF-8 fallback locale could be found. You can still build GJS, but
+some tests will fail.])
+])
+
+TEST_MSG=
+AM_COND_IF([DBUS_TESTS], [TEST_MSG="dbus-run-session"])
+AS_IF([test -z "$TEST_MSG"], [TEST_MSG="nothing special"])
+
+AC_MSG_RESULT([
+        $PACKAGE_NAME $VERSION
+
+       GJS_CFLAGS:             ${GJS_CFLAGS}
+       GJS_LIBS:               ${GJS_LIBS}
+
+       cairo:                  ${have_cairo}
+       readline:               ${ac_cv_header_readline_readline_h}
+       dtrace:                 ${enable_dtrace:-no}
+       systemtap:              ${enable_systemtap:-no}
+       Profiler:               ${enable_profiler}
+       Run GTK tests:          ${with_gtk_tests}
+       Run tests under:        ${TEST_MSG}
+       Code coverage:          ${enable_code_coverage}
+])
diff --git a/git.mk b/git.mk
new file mode 100644
index 00000000..facca559
--- /dev/null
+++ b/git.mk
@@ -0,0 +1,359 @@
+# git.mk, a small Makefile to autogenerate .gitignore files
+# for autotools-based projects.
+#
+# Copyright 2009, Red Hat, Inc.
+# Copyright 2010,2011,2012,2013 Behdad Esfahbod
+# Written by Behdad Esfahbod
+#
+# Copying and distribution of this file, with or without modification,
+# is permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+#
+# The latest version of this file can be downloaded from:
+GIT_MK_URL = https://raw.githubusercontent.com/behdad/git.mk/master/git.mk
+#
+# Bugs, etc, should be reported upstream at:
+#   https://github.com/behdad/git.mk
+#
+# To use in your project, import this file in your git repo's toplevel,
+# then do "make -f git.mk".  This modifies all Makefile.am files in
+# your project to -include git.mk.  Remember to add that line to new
+# Makefile.am files you create in your project, or just rerun the
+# "make -f git.mk".
+#
+# This enables automatic .gitignore generation.  If you need to ignore
+# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
+# But think twice before doing that.  If a file has to be in .gitignore,
+# chances are very high that it's a generated file and should be in one
+# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
+#
+# The only case that you need to manually add a file to GITIGNOREFILES is
+# when remove files in one of mostlyclean-local, clean-local, distclean-local,
+# or maintainer-clean-local make targets.
+#
+# Note that for files like editor backup, etc, there are better places to
+# ignore them.  See "man gitignore".
+#
+# If "make maintainer-clean" removes the files but they are not recognized
+# by this script (that is, if "git status" shows untracked files still), send
+# me the output of "git status" as well as your Makefile.am and Makefile for
+# the directories involved and I'll diagnose.
+#
+# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
+# Makefile.am.sample in the git.mk git repo.
+#
+# Don't EXTRA_DIST this file.  It is supposed to only live in git clones,
+# not tarballs.  It serves no useful purpose in tarballs and clutters the
+# build dir.
+#
+# This file knows how to handle autoconf, automake, libtool, gtk-doc,
+# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu, appdata,
+# appstream, hotdoc.
+#
+# This makefile provides the following targets:
+#
+# - all: "make all" will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
+#
+# KNOWN ISSUES:
+#
+# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
+#   submodule doesn't find us.  If you have configure.{in,ac} files in
+#   subdirs, add a proxy git.mk file in those dirs that simply does:
+#   "include $(top_srcdir)/../git.mk".  Add more ..'s to your taste.
+#   And add those files to git.  See vte/gnome-pty-helper/git.mk for
+#   example.
+#
+
+
+
+###############################################################################
+# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES:
+###############################################################################
+
+#
+# Most autotools-using modules should be fine including this variable in their
+# toplevel MAINTAINERCLEANFILES:
+GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \
+       $(srcdir)/aclocal.m4 \
+       $(srcdir)/autoscan.log \
+       $(srcdir)/configure.scan \
+       `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \
+        test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \
+        for x in \
+               ar-lib \
+               compile \
+               config.guess \
+               config.rpath \
+               config.sub \
+               depcomp \
+               install-sh \
+               ltmain.sh \
+               missing \
+               mkinstalldirs \
+               test-driver \
+               ylwrap \
+        ; do echo "$$AUX_DIR/$$x"; done` \
+       `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' ./configure.ac | \
+       head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done`
+#
+# All modules should also be fine including the following variable, which
+# removes automake-generated Makefile.in files:
+GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \
+       `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' ./configure.ac | \
+       while read f; do \
+         case $$f in Makefile|*/Makefile) \
+           test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \
+       done`
+#
+# Modules that use libtool and use  AC_CONFIG_MACRO_DIR() may also include this,
+# though it's harmless to include regardless.
+GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \
+       `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_MACRO_DIR:$$1' 
./configure.ac); \
+        if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \
+               for x in \
+                       libtool.m4 \
+                       ltoptions.m4 \
+                       ltsugar.m4 \
+                       ltversion.m4 \
+                       lt~obsolete.m4 \
+               ; do echo "$$MACRO_DIR/$$x"; done; \
+        fi`
+
+
+
+###############################################################################
+# Default rule is to install ourselves in all Makefile.am files:
+###############################################################################
+
+git-all: git-mk-install
+
+git-mk-install:
+       @echo "Installing git makefile"
+       @any_failed=; \
+               find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while 
read x; do \
+               if grep 'include .*/git.mk' $$x >/dev/null; then \
+                       echo "$$x already includes git.mk"; \
+               else \
+                       failed=; \
+                       echo "Updating $$x"; \
+                       { cat $$x; \
+                         echo ''; \
+                         echo '-include $$(top_srcdir)/git.mk'; \
+                       } > $$x.tmp || failed=1; \
+                       if test x$$failed = x; then \
+                               mv $$x.tmp $$x || failed=1; \
+                       fi; \
+                       if test x$$failed = x; then : else \
+                               echo "Failed updating $$x"; >&2 \
+                               any_failed=1; \
+                       fi; \
+       fi; done; test -z "$$any_failed"
+
+git-mk-update:
+       wget $(GIT_MK_URL) -O $(top_srcdir)/git.mk
+
+.PHONY: git-all git-mk-install git-mk-update
+
+
+
+###############################################################################
+# Actual .gitignore generation:
+###############################################################################
+
+$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
+       @echo "git.mk: Generating $@"
+       @{ \
+               if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
+                       for x in \
+                               $(DOC_MODULE)-decl-list.txt \
+                               $(DOC_MODULE)-decl.txt \
+                               tmpl/$(DOC_MODULE)-unused.sgml \
+                               "tmpl/*.bak" \
+                               $(REPORT_FILES) \
+                               $(DOC_MODULE).pdf \
+                               xml html \
+                       ; do echo "/$$x"; done; \
+                       FLAVOR=$$(cd $(top_srcdir); $(AUTOCONF) --trace 'GTK_DOC_CHECK:$$2' ./configure.ac); \
+                       case $$FLAVOR in *no-tmpl*) echo /tmpl;; esac; \
+                       if echo "$(SCAN_OPTIONS)" | grep -q "\-\-rebuild-types"; then \
+                               echo "/$(DOC_MODULE).types"; \
+                       fi; \
+                       if echo "$(SCAN_OPTIONS)" | grep -q "\-\-rebuild-sections"; then \
+                               echo "/$(DOC_MODULE)-sections.txt"; \
+                       fi; \
+                       if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
+                               for x in \
+                                       $(SETUP_FILES) \
+                                       $(DOC_MODULE).types \
+                               ; do echo "/$$x"; done; \
+                       fi; \
+               fi; \
+               if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+                       for lc in $(DOC_LINGUAS); do \
+                               for x in \
+                                       $(if $(DOC_MODULE),$(DOC_MODULE).xml) \
+                                       $(DOC_PAGES) \
+                                       $(DOC_INCLUDES) \
+                               ; do echo "/$$lc/$$x"; done; \
+                       done; \
+                       for x in \
+                               $(_DOC_OMF_ALL) \
+                               $(_DOC_DSK_ALL) \
+                               $(_DOC_HTML_ALL) \
+                               $(_DOC_MOFILES) \
+                               $(DOC_H_FILE) \
+                               "*/.xml2po.mo" \
+                               "*/*.omf.out" \
+                       ; do echo /$$x; done; \
+               fi; \
+               if test "x$(HOTDOC)" = x; then :; else \
+                       $(foreach project, $(HOTDOC_PROJECTS),echo "/$(call HOTDOC_TARGET,$(project))"; \
+                               echo "/$(shell $(call HOTDOC_PROJECT_COMMAND,$(project)) --get-conf-path 
output)" ; \
+                               echo "/$(shell $(call HOTDOC_PROJECT_COMMAND,$(project)) 
--get-private-folder)" ; \
+                       ) \
+                       for x in \
+                               .hotdoc.d \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
+                       for lc in $(HELP_LINGUAS); do \
+                               for x in \
+                                       $(HELP_FILES) \
+                                       "$$lc.stamp" \
+                                       "$$lc.mo" \
+                               ; do echo "/$$lc/$$x"; done; \
+                       done; \
+               fi; \
+               if test "x$(gsettings_SCHEMAS)" = x; then :; else \
+                       for x in \
+                               $(gsettings_SCHEMAS:.xml=.valid) \
+                               $(gsettings__enum_file) \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test "x$(appdata_XML)" = x; then :; else \
+                       for x in \
+                               $(appdata_XML:.xml=.valid) \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test "x$(appstream_XML)" = x; then :; else \
+                       for x in \
+                               $(appstream_XML:.xml=.valid) \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test -f $(srcdir)/po/Makefile.in.in; then \
+                       for x in \
+                               ABOUT-NLS \
+                               po/Makefile.in.in \
+                               po/Makefile.in.in~ \
+                               po/Makefile.in \
+                               po/Makefile \
+                               po/Makevars.template \
+                               po/POTFILES \
+                               po/Rules-quot \
+                               po/stamp-it \
+                               po/stamp-po \
+                               po/.intltool-merge-cache \
+                               "po/*.gmo" \
+                               "po/*.header" \
+                               "po/*.mo" \
+                               "po/*.sed" \
+                               "po/*.sin" \
+                               po/$(GETTEXT_PACKAGE).pot \
+                               intltool-extract.in \
+                               intltool-merge.in \
+                               intltool-update.in \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test -f $(srcdir)/configure; then \
+                       for x in \
+                               autom4te.cache \
+                               configure \
+                               config.h \
+                               stamp-h1 \
+                               libtool \
+                               config.lt \
+                       ; do echo "/$$x"; done; \
+               fi; \
+               if test "x$(DEJATOOL)" = x; then :; else \
+                       for x in \
+                               $(DEJATOOL) \
+                       ; do echo "/$$x.sum"; echo "/$$x.log"; done; \
+                       echo /site.exp; \
+               fi; \
+               if test "x$(am__dirstamp)" = x; then :; else \
+                       echo "$(am__dirstamp)"; \
+               fi; \
+               if test "x$(findstring libtool,$(LTCOMPILE))" = x -a "x$(findstring libtool,$(LTCXXCOMPILE))" 
= x -a "x$(GTKDOC_RUN)" = x; then :; else \
+                       for x in \
+                               "*.lo" \
+                               ".libs" "_libs" \
+                       ; do echo "$$x"; done; \
+               fi; \
+               for x in \
+                       .gitignore \
+                       $(GITIGNOREFILES) \
+                       $(CLEANFILES) \
+                       $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
+                       $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
+                       $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
+                       so_locations \
+                       $(MOSTLYCLEANFILES) \
+                       $(TEST_LOGS) \
+                       $(TEST_LOGS:.log=.trs) \
+                       $(TEST_SUITE_LOG) \
+                       $(TESTS:=.test) \
+                       "*.gcda" \
+                       "*.gcno" \
+                       $(DISTCLEANFILES) \
+                       $(am__CONFIG_DISTCLEAN_FILES) \
+                       $(CONFIG_CLEAN_FILES) \
+                       TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
+                       "*.tab.c" \
+                       $(MAINTAINERCLEANFILES) \
+                       $(BUILT_SOURCES) \
+                       $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \
+                       $(filter %_vala.stamp,$(DIST_COMMON)) \
+                       $(filter %.vapi,$(DIST_COMMON)) \
+                       $(filter $(addprefix %,$(notdir $(patsubst %.vapi,%.h,$(filter 
%.vapi,$(DIST_COMMON))))),$(DIST_COMMON)) \
+                       Makefile \
+                       Makefile.in \
+                       "*.orig" \
+                       "*.rej" \
+                       "*.bak" \
+                       "*~" \
+                       ".*.sw[nop]" \
+                       ".dirstamp" \
+               ; do echo "/$$x"; done; \
+               for x in \
+                       "*.$(OBJEXT)" \
+                       $(DEPDIR) \
+               ; do echo "$$x"; done; \
+       } | \
+       sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
+       sed 's@/[.]/@/@g' | \
+       LC_ALL=C sort | uniq > $@.tmp && \
+       mv $@.tmp $@;
+
+all: $(srcdir)/.gitignore gitignore-recurse-maybe
+gitignore: $(srcdir)/.gitignore gitignore-recurse
+
+gitignore-recurse-maybe:
+       @for subdir in $(DIST_SUBDIRS); do \
+         case " $(SUBDIRS) " in \
+           *" $$subdir "*) :;; \
+           *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore 
|| echo "Skipping $$subdir");; \
+         esac; \
+       done
+gitignore-recurse:
+       @for subdir in $(DIST_SUBDIRS); do \
+           test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || 
echo "Skipping $$subdir"); \
+       done
+
+maintainer-clean: gitignore-clean
+gitignore-clean:
+       -rm -f $(srcdir)/.gitignore
+
+.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
diff --git a/gjs-1.0.pc.in b/gjs-1.0.pc.in
new file mode 100644
index 00000000..1c52230e
--- /dev/null
+++ b/gjs-1.0.pc.in
@@ -0,0 +1,18 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+bindir=@bindir@
+includedir=@includedir@
+datarootdir=@datarootdir@
+datadir=@datadir@
+
+gjs_console=${bindir}/gjs-console
+
+Cflags: -I${includedir}/gjs-1.0
+Requires: @AX_PACKAGE_REQUIRES@
+Requires.private: @AX_PACKAGE_REQUIRES_PRIVATE@
+Libs: -L${libdir} -lgjs
+
+Name: gjs-1.0
+Description: JS bindings for GObjects
+Version: @VERSION@
diff --git a/gjs-modules-srcs.mk b/gjs-modules-srcs.mk
new file mode 100644
index 00000000..ca08fe7f
--- /dev/null
+++ b/gjs-modules-srcs.mk
@@ -0,0 +1,34 @@
+module_console_srcs =          \
+       modules/console.h       \
+       modules/console.cpp     \
+       $(NULL)
+
+module_resource_srcs =         \
+       modules-resources.c     \
+       modules-resources.h     \
+       $(NULL)
+
+module_system_srcs =           \
+       modules/system.h        \
+       modules/system.cpp      \
+       $(NULL)
+
+module_cairo_srcs =                            \
+       modules/cairo-private.h                 \
+       modules/cairo-module.h                  \
+       modules/cairo-region.cpp                \
+       modules/cairo-context.cpp               \
+       modules/cairo-path.cpp                  \
+       modules/cairo-surface.cpp               \
+       modules/cairo-image-surface.cpp         \
+       modules/cairo-ps-surface.cpp            \
+       modules/cairo-pdf-surface.cpp           \
+       modules/cairo-svg-surface.cpp           \
+       modules/cairo-pattern.cpp               \
+       modules/cairo-gradient.cpp              \
+       modules/cairo-linear-gradient.cpp       \
+       modules/cairo-radial-gradient.cpp       \
+       modules/cairo-surface-pattern.cpp       \
+       modules/cairo-solid-pattern.cpp         \
+       modules/cairo.cpp                       \
+       $(NULL)
diff --git a/gjs-srcs.mk b/gjs-srcs.mk
new file mode 100644
index 00000000..f02ad3a5
--- /dev/null
+++ b/gjs-srcs.mk
@@ -0,0 +1,113 @@
+gjs_public_headers =           \
+       gjs/context.h           \
+       gjs/coverage.h          \
+       gjs/error-types.h       \
+       gjs/gjs.h               \
+       gjs/macros.h            \
+       gjs/mem.h               \
+       gjs/profiler.h          \
+       $(NULL)
+
+# For historical reasons, some files live in gi/
+# Some headers in the following list were formerly
+# public
+
+gjs_srcs =                             \
+       gi/arg.cpp                      \
+       gi/arg.h                        \
+       gi/boxed.cpp                    \
+       gi/boxed.h                      \
+       gi/closure.cpp                  \
+       gi/closure.h                    \
+       gi/enumeration.cpp              \
+       gi/enumeration.h                \
+       gi/foreign.cpp                  \
+       gi/foreign.h                    \
+       gi/fundamental.cpp              \
+       gi/fundamental.h                \
+       gi/function.cpp                 \
+       gi/function.h                   \
+       gi/gerror.cpp                   \
+       gi/gerror.h                     \
+       gi/gjs_gi_trace.h               \
+       gi/gobject.cpp                  \
+       gi/gobject.h                    \
+       gi/gtype.cpp                    \
+       gi/gtype.h                      \
+       gi/interface.cpp                \
+       gi/interface.h                  \
+       gi/ns.cpp                       \
+       gi/ns.h                         \
+       gi/object.cpp                   \
+       gi/object.h                     \
+       gi/param.cpp                    \
+       gi/param.h                      \
+       gi/private.cpp                  \
+       gi/private.h                    \
+       gi/repo.cpp                     \
+       gi/repo.h                       \
+       gi/toggle.cpp                   \
+       gi/toggle.h                     \
+       gi/union.cpp                    \
+       gi/union.h                      \
+       gi/value.cpp                    \
+       gi/value.h                      \
+       gi/wrapperutils.cpp             \
+       gi/wrapperutils.h               \
+       gjs/atoms.cpp                   \
+       gjs/atoms.h                     \
+       gjs/byteArray.cpp               \
+       gjs/byteArray.h                 \
+       gjs/context.cpp                 \
+       gjs/context-private.h           \
+       gjs/coverage.cpp                \
+       gjs/debugger.cpp                \
+       gjs/deprecation.cpp             \
+       gjs/deprecation.h               \
+       gjs/error-types.cpp             \
+       gjs/engine.cpp                  \
+       gjs/engine.h                    \
+       gjs/global.cpp                  \
+       gjs/global.h                    \
+       gjs/importer.cpp                \
+       gjs/importer.h                  \
+       gjs/mem.cpp                     \
+       gjs/mem-private.h               \
+       gjs/module.h                    \
+       gjs/module.cpp                  \
+       gjs/native.cpp                  \
+       gjs/native.h                    \
+       gjs/profiler.cpp                \
+       gjs/profiler-private.h          \
+       gjs/stack.cpp                   \
+       modules/modules.cpp             \
+       modules/modules.h               \
+       $(NULL)
+
+gjs_jsapi_srcs =                       \
+       gjs/jsapi-class.h               \
+       gjs/jsapi-dynamic-class.cpp     \
+       gjs/jsapi-util.cpp              \
+       gjs/jsapi-util.h                \
+       gjs/jsapi-util-args.h           \
+       gjs/jsapi-util-error.cpp        \
+       gjs/jsapi-util-root.h           \
+       gjs/jsapi-util-string.cpp       \
+       gjs/jsapi-wrapper.h             \
+       util/log.cpp                    \
+       util/log.h                      \
+       util/misc.cpp                   \
+       util/misc.h                     \
+       $(NULL)
+
+# These files were part of a separate library
+gjs_private_srcs =                             \
+       libgjs-private/gjs-gdbus-wrapper.c      \
+       libgjs-private/gjs-gdbus-wrapper.h      \
+       libgjs-private/gjs-util.c               \
+       libgjs-private/gjs-util.h               \
+       $(NULL)
+
+gjs_console_srcs =     \
+       gjs/console.cpp \
+       $(NULL)
diff --git a/m4/code_coverage.m4 b/m4/code_coverage.m4
new file mode 100644
index 00000000..440d538f
--- /dev/null
+++ b/m4/code_coverage.m4
@@ -0,0 +1,191 @@
+# Fork of an old version of AX_CODE_COVERAGE:
+#     https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
+#
+# This macro broke API, and had some bugs introduced in it, so this is a copy of
+# the last good version.
+
+AC_DEFUN([GJS_CODE_COVERAGE],[
+       dnl Check for --enable-code-coverage
+       AC_REQUIRE([AC_PROG_SED])
+
+       # allow to override gcov location
+       AC_ARG_WITH([gcov],
+         [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
+         [_GJS_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
+         [_GJS_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
+
+       AC_MSG_CHECKING([whether to build with code coverage support])
+       AC_ARG_ENABLE([code-coverage],
+         AS_HELP_STRING([--enable-code-coverage],
+         [Whether to enable code coverage support]),,
+         enable_code_coverage=no)
+
+       AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
+       AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
+       AC_MSG_RESULT($enable_code_coverage)
+
+       AS_IF([ test "$enable_code_coverage" = "yes" ], [
+               # check for gcov
+               AC_CHECK_TOOL([GCOV],
+                 [$_GJS_CODE_COVERAGE_GCOV_PROG_WITH],
+                 [:])
+               AS_IF([test "X$GCOV" = "X:"],
+                 [AC_MSG_ERROR([gcov is needed to do coverage])])
+               AC_SUBST([GCOV])
+
+               dnl Check if gcc is being used
+               AS_IF([ test "$GCC" = "no" ], [
+                       AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
+               ])
+
+               AC_CHECK_PROG([LCOV], [lcov], [lcov])
+               AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
+
+               AS_IF([ test -z "$LCOV" ], [
+                       AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
+               ])
+
+               AS_IF([ test -z "$GENHTML" ], [
+                       AC_MSG_ERROR([Could not find genhtml from the lcov package])
+               ])
+
+               dnl Build the code coverage flags
+               dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
+               CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
+               CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+               CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+               CODE_COVERAGE_LIBS="-lgcov"
+               CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
+
+               AC_SUBST([CODE_COVERAGE_CPPFLAGS])
+               AC_SUBST([CODE_COVERAGE_CFLAGS])
+               AC_SUBST([CODE_COVERAGE_CXXFLAGS])
+               AC_SUBST([CODE_COVERAGE_LIBS])
+               AC_SUBST([CODE_COVERAGE_LDFLAGS])
+
+               [CODE_COVERAGE_RULES_CHECK='
+       -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
+       $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
+']
+               [CODE_COVERAGE_RULES_CAPTURE='
+       $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory 
,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call 
code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool 
$(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
+       $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory 
,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" 
$(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) 
$(CODE_COVERAGE_LCOV_RMOPTS)
+       -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
+       $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix 
,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title 
"$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" 
$(CODE_COVERAGE_GENHTML_OPTIONS)
+       @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
+']
+               [CODE_COVERAGE_RULES_CLEAN='
+clean: code-coverage-clean
+distclean: code-coverage-clean
+code-coverage-clean:
+       -$(LCOV) --directory $(top_builddir) -z
+       -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp 
$(CODE_COVERAGE_OUTPUT_DIRECTORY)
+       -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
+']
+       ], [
+               [CODE_COVERAGE_RULES_CHECK='
+       @echo "Need to reconfigure with --enable-code-coverage"
+']
+               CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
+               CODE_COVERAGE_RULES_CLEAN=''
+       ])
+
+[CODE_COVERAGE_RULES='
+# Code coverage
+#
+# Optional:
+#  - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
+#    Multiple directories may be specified, separated by whitespace.
+#    (Default: $(top_builddir))
+#  - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
+#    by lcov for code coverage. (Default:
+#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
+#  - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
+#    reports to be created. (Default:
+#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
+#  - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
+#    set to 0 to disable it and leave empty to stay with the default.
+#    (Default: empty)
+#  - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
+#    instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
+#  - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
+#    instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
+#  - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
+#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
+#    collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
+#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
+#    instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
+#  - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
+#    lcov instance. (Default: empty)
+#  - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
+#    instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
+#  - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
+#    genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
+#  - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
+#    instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
+#  - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
+#
+# The generated report will be titled using the $(PACKAGE_NAME) and
+# $(PACKAGE_VERSION). In order to add the current git hash to the title,
+# use the git-version-gen script, available online.
+
+# Optional variables
+CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
+CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
+CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
+CODE_COVERAGE_BRANCH_COVERAGE ?=
+CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
+--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
+CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
+CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
+CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
+CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
+CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
+CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
+CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
+$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
+--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
+CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
+CODE_COVERAGE_IGNORE_PATTERN ?=
+
+GITIGNOREFILES ?=
+GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
+
+code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
+code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
+code_coverage_v_lcov_cap_0 = @echo "  LCOV   --capture"\
+ $(CODE_COVERAGE_OUTPUT_FILE);
+code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
+code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
+code_coverage_v_lcov_ign_0 = @echo "  LCOV   --remove /tmp/*"\
+ $(CODE_COVERAGE_IGNORE_PATTERN);
+code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
+code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
+code_coverage_v_genhtml_0 = @echo "  GEN   " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
+code_coverage_quiet = $(code_coverage_quiet_$(V))
+code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
+code_coverage_quiet_0 = --quiet
+
+# sanitizes the test-name: replaces with underscores: dashes and dots
+code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
+
+# Use recursive makes in order to ignore errors during check
+check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
+
+# Capture code coverage data
+code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
+
+# Hook rule executed before code-coverage-capture, overridable by the user
+code-coverage-capture-hook:
+
+'"$CODE_COVERAGE_RULES_CLEAN"'
+
+A''M_DISTCHECK_CONFIGURE_FLAGS ?=
+A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
+
+.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
+']
+
+       AC_SUBST([CODE_COVERAGE_RULES])
+       m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
+])
diff --git a/m4/extensions.m4 b/m4/extensions.m4
new file mode 100644
index 00000000..d1b23215
--- /dev/null
+++ b/m4/extensions.m4
@@ -0,0 +1,183 @@
+# serial 17  -*- Autoconf -*-
+# Enable extensions on systems that normally disable them.
+
+# Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
+# Autoconf.  Perhaps we can remove this once we can assume Autoconf
+# 2.70 or later everywhere, but since Autoconf mutates rapidly
+# enough in this area it's likely we'll need to redefine
+# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+
+# If autoconf reports a warning
+#     warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or  warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+#   1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+#      but always AC_REQUIREd,
+#   2) to ensure that for each occurrence of
+#        AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+#      or
+#        AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+#      the corresponding gnulib module description has 'extensions' among
+#      its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+#      invocation occurs in gl_EARLY, not in gl_INIT.
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+#
+# Remember that #undef in AH_VERBATIM gets replaced with #define by
+# AC_DEFINE.  The goal here is to define all known feature-enabling
+# macros, then, if reports of conflicts are made, disable macros that
+# cause problems on some platforms (such as __EXTENSIONS__).
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
+[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+
+  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
+  if test "$MINIX" = yes; then
+    AC_DEFINE([_POSIX_SOURCE], [1],
+      [Define to 1 if you need to in order for 'stat' and other
+       things to work.])
+    AC_DEFINE([_POSIX_1_SOURCE], [2],
+      [Define to 2 if the system does not provide POSIX.1 features
+       except with this defined.])
+    AC_DEFINE([_MINIX], [1],
+      [Define to 1 if on MINIX.])
+    AC_DEFINE([_NETBSD_SOURCE], [1],
+      [Define to 1 to make NetBSD features available.  MINIX 3 needs this.])
+  fi
+
+dnl Use a different key than __EXTENSIONS__, as that name broke existing
+dnl configure.ac when using autoheader 2.62.
+  AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
+[/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable general extensions on macOS.  */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable NetBSD extensions on NetBSD.  */
+#ifndef _NETBSD_SOURCE
+# undef _NETBSD_SOURCE
+#endif
+/* Enable OpenBSD extensions on NetBSD.  */
+#ifndef _OPENBSD_SOURCE
+# undef _OPENBSD_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014.  */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014.  */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# undef __STDC_WANT_IEC_60559_BFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015.  */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# undef __STDC_WANT_IEC_60559_DFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015.  */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-3:2015.  */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# undef __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010.  */
+#ifndef __STDC_WANT_LIB_EXT2__
+# undef __STDC_WANT_LIB_EXT2__
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009.  */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# undef __STDC_WANT_MATH_SPEC_FUNCS__
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable X/Open extensions if necessary.  HP-UX 11.11 defines
+   mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
+   whether compiling with -Ae or -D_HPUX_SOURCE=1.  */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+])
+  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+    [ac_cv_safe_to_define___extensions__],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+#         define __EXTENSIONS__ 1
+          ]AC_INCLUDES_DEFAULT])],
+       [ac_cv_safe_to_define___extensions__=yes],
+       [ac_cv_safe_to_define___extensions__=no])])
+  test $ac_cv_safe_to_define___extensions__ = yes &&
+    AC_DEFINE([__EXTENSIONS__])
+  AC_DEFINE([_ALL_SOURCE])
+  AC_DEFINE([_DARWIN_C_SOURCE])
+  AC_DEFINE([_GNU_SOURCE])
+  AC_DEFINE([_NETBSD_SOURCE])
+  AC_DEFINE([_OPENBSD_SOURCE])
+  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+  AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
+  AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__])
+  AC_DEFINE([__STDC_WANT_LIB_EXT2__])
+  AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
+  AC_DEFINE([_TANDEM_SOURCE])
+  AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
+    [ac_cv_should_define__xopen_source],
+    [ac_cv_should_define__xopen_source=no
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #include <wchar.h>
+          mbstate_t x;]])],
+       [],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[
+             #define _XOPEN_SOURCE 500
+             #include <wchar.h>
+             mbstate_t x;]])],
+          [ac_cv_should_define__xopen_source=yes])])])
+  test $ac_cv_should_define__xopen_source = yes &&
+    AC_DEFINE([_XOPEN_SOURCE], [500])
+])# AC_USE_SYSTEM_EXTENSIONS
+
+# gl_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
+[
+  dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
+  dnl gnulib does not need it. But if it gets required by third-party macros
+  dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
+  dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
+  dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
+  dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
new file mode 100644
index 00000000..d5c35c57
--- /dev/null
+++ b/m4/timer_time.m4
@@ -0,0 +1,44 @@
+# timer_time.m4 serial 3
+dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Check for timer_settime, and set LIB_TIMER_TIME.
+
+AC_DEFUN([gl_TIMER_TIME],
+[
+  dnl Based on clock_time.m4. See details there.
+
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  dnl Test whether the gnulib module 'threadlib' is in use.
+  dnl Some packages like Emacs use --avoid=threadlib.
+  dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+  dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+  m4_ifdef([gl_][THREADLIB], [AC_REQUIRE([gl_][THREADLIB])])
+
+  LIB_TIMER_TIME=
+  AC_SUBST([LIB_TIMER_TIME])
+  gl_saved_libs=$LIBS
+    AC_SEARCH_LIBS([timer_settime], [rt posix4],
+                   [test "$ac_cv_search_timer_settime" = "none required" ||
+                    LIB_TIMER_TIME=$ac_cv_search_timer_settime])
+    m4_ifdef([gl_][THREADLIB],
+      [dnl GLIBC uses threads to emulate posix timers when kernel support
+       dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
+       dnl Now the pthread lib is linked automatically in the normal case,
+       dnl but when linking statically, it needs to be explicitly specified.
+       AC_EGREP_CPP([Thread],
+         [#include <features.h>
+          #ifdef __GNU_LIBRARY__
+           #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
+               && !(__UCLIBC__ && __HAS_NO_THREADS__)
+            Thread emulation available
+           #endif
+          #endif
+         ],
+         [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])])
+    AC_CHECK_FUNCS([timer_settime])
+  LIBS=$gl_saved_libs
+])
diff --git a/meson.build b/meson.build
index d843e9f2..193c9964 100644
--- a/meson.build
+++ b/meson.build
@@ -285,6 +285,18 @@ header_conf.set('_GNU_SOURCE', 1)
 
 configure_file(output: 'config.h', configuration: header_conf)
 
+### Generate config.h for win32 ################################################
+
+win32_header_conf = configuration_data()
+win32_header_conf.set('GJS_VERSION', int_version)
+win32_header_conf.set('PACKAGE', meson.project_name())
+win32_header_conf.set('PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/gjs')
+win32_header_conf.set('PACKAGE_NAME', meson.project_name())
+win32_header_conf.set('PACKAGE_VERSION', meson.project_version())
+win32_header_conf.set('PACKAGE_TARNAME', meson.project_name())
+configure_file(input: 'win32/config.h.win32.in', output: 'config.h.win32',
+    configuration: win32_header_conf)
+
 ### Check for environment ######################################################
 
 if cxx.get_id() == 'msvc'
diff --git a/test/extra/do_environment.sh b/test/extra/do_environment.sh
index 871114ee..514d48ce 100755
--- a/test/extra/do_environment.sh
+++ b/test/extra/do_environment.sh
@@ -1,5 +1,18 @@
 #!/bin/sh -e
 
+do_Configure_MainBuild () {
+    do_Print_Labels 'Set Main Build Configuration'
+
+    autogenargs="--enable-compile-warnings=yes"
+
+    if test -n "$BUILD_OPTS"; then
+        autogenargs="$autogenargs $BUILD_OPTS"
+    fi
+    export ci_autogenargs="$autogenargs"
+
+    echo '-- Done --'
+}
+
 do_Print_Labels () {
     if test -n "$1"; then
         label_len=${#1}
diff --git a/test/test-ci.sh b/test/test-ci.sh
index 52e2fa9e..864393e2 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -103,6 +103,33 @@ if test "$1" = "SETUP"; then
     do_Print_Labels 'Show GJS git information'
     git log --pretty=format:"%h %cd %s" -1
 
+elif test "$1" = "GJS"; then
+    do_Set_Env
+    do_Show_Info
+
+    do_Configure_MainBuild
+
+    # Build and test the latest commit (merged or from a merge/pull request) of
+    # Javascript Bindings for GNOME (gjs)
+    do_Print_Labels 'Show GJS git information'
+    git log --pretty=format:"%h %cd %s" -1
+
+    do_Print_Labels 'Do the GJS build'
+
+    export AM_DISTCHECK_CONFIGURE_FLAGS="--enable-compile-warnings=yes"
+
+    # Regular (autotools only) build
+    echo "Autogen options: $ci_autogenargs"
+    eval ./autogen.sh "$ci_autogenargs"
+
+    make -sj 2>&1
+
+    if test "$TEST" = "distcheck"; then
+        xvfb-run -a make -s distcheck
+    elif test "$TEST" = "check"; then
+        xvfb-run -a make -s check
+    fi
+
 elif test "$1" = "BUILD"; then
     do_Set_Env
 
diff --git a/verbump.py b/verbump.py
new file mode 100644
index 00000000..cbf6346a
--- /dev/null
+++ b/verbump.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# Automakes a release preparation for a post-release project
+# * Create a git tag
+# * Bump version in configure.ac and commit it
+
+import re
+import os
+import sys
+import subprocess
+
+micro_version_re = re.compile('m4_define.*pkg_micro_version, ([0-9]+)')
+micro_version_replace = 'm4_define(pkg_micro_version, %d)\n'
+
+def _extract_config_log_variable(name):
+    f = open('config.log')
+    keystart = name + '=\''
+    for line in f:
+        if line.startswith(keystart):
+            return line[len(keystart):-2]
+    f.close()
+    fatal("Failed to find '%s' in config.status" % (name, ))
+
+if not os.path.isfile('config.log'):
+    fatal("Couldn't find config.log; did you run configure?")
+package = _extract_config_log_variable('PACKAGE_TARNAME')
+version = _extract_config_log_variable('VERSION')
+
+configure_path=os.path.join(os.environ['top_srcdir'], 'configure.ac')
+f = open(configure_path)
+newf = open(configure_path + '.tmp', 'w')
+for line in f:
+  m = micro_version_re.match(line)
+  if not m:
+    newf.write(line)
+    continue
+  v = int(m.group(1))
+  newv = v+1
+  print "Will update micro version from %s to %s" % (v, newv)
+  newf.write(micro_version_replace % (newv, ))
+newf.close()
+
+os.rename(configure_path + '.tmp', configure_path)
+print "Successfully wrote new 'configure.ac' with post-release version bump"
+
+args=['git', 'commit', '-m', "configure: Post-release version bump", configure_path]
+print "Running: %r" % (args, )
+subprocess.check_call(args)
diff --git a/win32/Makefile.vc b/win32/Makefile.vc
new file mode 100644
index 00000000..f56d83f0
--- /dev/null
+++ b/win32/Makefile.vc
@@ -0,0 +1,66 @@
+# NMake Makefile for building GJS on Windows
+
+# The items below this line should not be changed, unless one is maintaining
+# the NMake Makefiles.  Customizations can be done in the following NMake Makefile
+# portions (please see comments in the these files to see what can be customized):
+#
+# detectenv-msvc.mak
+# config-msvc.mak
+
+!include detectenv-msvc.mak
+
+# Include the Makefile portions with the source listings
+!include ..\gjs-srcs.mk
+!include ..\gjs-modules-srcs.mk
+
+# Include the Makefile portion that enables features based on user input
+!include config-msvc.mak
+
+!if "$(VALID_CFGSET)" == "TRUE"
+
+# We need Visual Studio 2017 15.6 or later
+!if $(VCVERSION) < 1913
+VALID_MSC = FALSE
+!else
+VALID_MSC = TRUE
+!endif
+
+!if "$(VALID_MSC)" == "TRUE"
+
+# Include the Makefile portion to convert the source and header lists
+# into the lists we need for compilation and introspection
+!include create-lists-msvc.mak
+
+all: $(GJS_LIBS) $(EXTRA_TARGETS) $(GJS_UTILS) all-build-info
+
+tests: all
+
+# Include the build rules for sources, DLLs and executables
+!include build-rules-msvc.mak
+
+# Include the rules for build directory creation and code generation
+!include generate-msvc.mak
+
+# Generate the introspection files
+
+!if "$(INTROSPECTION)" == "1"
+# Include the rules for building the introspection files
+!include introspection-msvc.mak
+!include gjs-introspection-msvc.mak
+!endif
+
+!include install.mak
+
+!else # "$(VALID_MSC)" == "TRUE"
+all:
+       @echo You need Visual Studio 2017 15.6 or later.
+
+!endif # "$(VALID_MSC)" == "TRUE"
+
+!else # "$(VALID_CFGSET)" == "TRUE"
+all: help
+       @echo You need to specify a valid configuration, via
+       @echo CFG=release or CFG=debug
+!endif # "$(VALID_CFGSET)" == "TRUE"
+
+!include info-msvc.mak
diff --git a/win32/build-rules-msvc.mak b/win32/build-rules-msvc.mak
new file mode 100644
index 00000000..48674b0e
--- /dev/null
+++ b/win32/build-rules-msvc.mak
@@ -0,0 +1,149 @@
+# NMake Makefile portion for compilation rules
+# Items in here should not need to be edited unless
+# one is maintaining the NMake build files.  The format
+# of NMake Makefiles here are different from the GNU
+# Makefiles.  Please see the comments about these formats.
+
+# Inference rules for compiling the .obj files.
+# Used for libs and programs with more than a single source file.
+# Format is as follows
+# (all dirs must have a trailing '\'):
+#
+# {$(srcdir)}.$(srcext){$(destdir)}.obj::
+#      $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
+# $<
+# <<
+{..\modules\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\module-console\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\module-console\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\module-console\ /c @<<
+$<
+<<
+
+{..\modules\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\module-system\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\module-system\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\module-system\ /c @<<
+$<
+<<
+
+{..\modules\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\ /c @<<
+$<
+<<
+
+{..\gi\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{..\gjs\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{..\libgjs-private\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{..\libgjs-private\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CC) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{..\modules\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{..\util\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CXX) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{vs$(VSVER)\$(CFG)\$(PLAT)\module-resources\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\}.obj::
+       $(CC) $(CFLAGS) $(LIBGJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libgjs\ /c @<<
+$<
+<<
+
+{..\gjs\}.cpp{vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console\}.obj::
+       $(CXX) $(CFLAGS) $(GJS_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\gjs-console\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\gjs-console\ /c @<<
+$<
+<<
+
+# Rules for building .lib files
+vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib: $(LIBGJS_DLL_FILENAME).dll
+
+# Rules for linking DLLs
+# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
+# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
+#      link /DLL [$(linker_flags)] [$(dependent_libs)] [/def:$(def_file_if_used)] 
[/implib:$(lib_name_if_needed)] -out:$@ @<<
+# $(dependent_objects)
+# <<
+#      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+$(LIBGJS_DLL_FILENAME).dll:            \
+$(GJS_INCLUDED_MODULES)                        \
+vs$(VSVER)\$(CFG)\$(PLAT)\module-resources             \
+vs$(VSVER)\$(CFG)\$(PLAT)\libgjs                       \
+$(module_resources_generated_srcs)     \
+$(libgjs_dll_OBJS)
+       link /DLL $(LDFLAGS) $(GJS_INCLUDED_MODULES)            \
+       $(LIBGJS_DEP_LIBS) /implib:vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib    \
+       -out:$@ @<<
+$(libgjs_dll_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+
+vs$(VSVER)\$(CFG)\$(PLAT)\module-console.lib: vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\config.h 
vs$(VSVER)\$(CFG)\$(PLAT)\module-console $(module_console_OBJS)
+       lib $(ARFLAGS) -out:$@ @<<
+$(module_console_OBJS)
+<<
+
+vs$(VSVER)\$(CFG)\$(PLAT)\module-system.lib: vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\config.h 
vs$(VSVER)\$(CFG)\$(PLAT)\module-system $(module_system_OBJS)
+       lib $(ARFLAGS) -out:$@ @<<
+$(module_system_OBJS)
+<<
+
+vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo.lib: vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\config.h 
vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo $(module_cairo_OBJS)
+       lib $(ARFLAGS) -out:$@ @<<
+$(module_cairo_OBJS)
+<<
+
+# Rules for linking Executables
+# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
+# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
+#      link [$(linker_flags)] [$(dependent_libs)] -out:$@ @<<
+# $(dependent_objects)
+# <<
+#      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+
+vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console.exe: vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib 
vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console $(gjs_OBJS)
+       link $(LDFLAGS) vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib $(GJS_BASE_LIBS) -out:$@ $(gjs_OBJS)
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+
+clean:
+       @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib del /f /q 
vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib
+       @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.gir del /f /q 
vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.gir
+       @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\gjs_private_list del /f /q 
vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\gjs_private_list
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.dll
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exp
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.lib
+       @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\ del /f /q 
vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\vc$(PDBVER)0.pdb
+       @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\ del /f /q 
vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\*.obj
+       @-if exist vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo\ rd vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console\vc$(PDBVER)0.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console\*.obj
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\vc$(PDBVER)0.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\*.obj
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\module-system\vc$(PDBVER)0.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\module-system\*.obj
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\module-system
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\module-console\vc$(PDBVER)0.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\module-console\*.obj
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\module-console
+       @-del /f /q $(module_resources_generated_srcs)
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\module-resources
+       @-del vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\config.h
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libgjs
+       @-del /f /q vc$(PDBVER)0.pdb
diff --git a/win32/config-msvc.mak b/win32/config-msvc.mak
new file mode 100644
index 00000000..a7aeb7e0
--- /dev/null
+++ b/win32/config-msvc.mak
@@ -0,0 +1,118 @@
+# NMake Makefile portion for enabling features for Windows builds
+
+# Spidermonkey release series (17, 24, 31, 38, 45 etc.)
+MOZJS_VERSION = 60
+
+# Please see https://bugzilla.gnome.org/show_bug.cgi?id=775868,
+# comments 26, 27 and 28
+!if "$(MOZJS_VERSION)" == "31"
+MOZ_BUG_WORKAROUND_CFLAG = /DJSGC_USE_EXACT_ROOTING=1
+!else
+MOZ_BUG_WORKAROUND_CFLAG =
+!endif
+
+# These are the base minimum libraries required for building gjs.
+BASE_INCLUDES =                                                                \
+       /I$(PREFIX)\include\gobject-introspection-1.0\girepository      \
+       /I$(PREFIX)\include\glib-2.0                                    \
+       /I$(PREFIX)\lib\glib-2.0\include                                \
+       /I$(PREFIX)\include\mozjs-$(MOZJS_VERSION)                      \
+       /I$(PREFIX)\include
+
+GJS_BASE_LIBS = gio-2.0.lib gobject-2.0.lib glib-2.0.lib
+LIBGJS_BASE_DEP_LIBS =                 \
+       girepository-1.0.lib            \
+       $(GJS_BASE_LIBS)                \
+       ffi.lib                         \
+       intl.lib                        \
+       mozjs-$(MOZJS_VERSION).lib
+
+# For Cairo support
+CAIRO_LIBS = cairo-gobject.lib cairo.lib
+
+# Please do not change anything beneath this line unless maintaining the NMake Makefiles
+# Bare minimum features and sources built into GJS on Windows
+
+# We build the resource module sources directly into the gjs DLL, not as a separate .lib,
+# so that we don't have to worry about the Visual Studio linker dropping items during
+# optimization
+GJS_DEFINES =
+GJS_INCLUDED_MODULES =                                 \
+       vs$(VSVER)\$(CFG)\$(PLAT)\module-console.lib    \
+       vs$(VSVER)\$(CFG)\$(PLAT)\module-system.lib
+
+GJS_BASE_CFLAGS =                      \
+       /I..                            \
+       /Ivs$(VSVER)\$(CFG)\$(PLAT)\libgjs      \
+       /FImsvc_recommended_pragmas.h   \
+       /FIjs\RequiredDefines.h         \
+       /Dssize_t=gssize                \
+       /wd4530                         \
+       /wd4099                         \
+       /wd4251                         \
+       /wd4800                         \
+       /Zc:externConstexpr
+
+GJS_CFLAGS_WITH_LOG = /DG_LOG_DOMAIN=\"Gjs\"
+
+LIBGJS_DEP_INCLUDES = $(BASE_INCLUDES)
+LIBGJS_DEP_LIBS = $(LIBGJS_BASE_DEP_LIBS)
+
+LIBGJS_PRIVATE_SOURCES = $(gjs_private_srcs)
+LIBGJS_HEADERS = $(gjs_public_headers:/=\)
+
+# We build libgjs and gjs-console at least
+GJS_LIBS = vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib
+
+GJS_UTILS = vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console.exe
+GJS_TESTS =
+
+# Enable Cairo
+!if "$(NO_CAIRO)" != "1"
+GJS_DEFINES = $(GJS_DEFINES) /DENABLE_CAIRO
+GJS_INCLUDED_MODULES =         \
+       $(GJS_INCLUDED_MODULES) \
+       vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo.lib
+LIBGJS_DEP_LIBS = $(CAIRO_LIBS) $(LIBGJS_DEP_LIBS)
+!endif
+
+INTROSPECTION_INCLUDE_PACKAGES = --include=Gio-2.0 --include=GObject-2.0
+GJS_INTROSPECTION_CHECK_PACKAGE = gio-2.0
+
+LIBGJS_SOURCES = $(gjs_srcs) $(LIBGJS_PRIVATE_SOURCES)
+
+# Use libtool-style DLL names, if desired
+!if "$(LIBTOOL_DLL_NAME)" == "1"
+LIBGJS_DLL_FILENAME = vs$(VSVER)\$(CFG)\$(PLAT)\libgjs-0
+!else
+LIBGJS_DLL_FILENAME = vs$(VSVER)\$(CFG)\$(PLAT)\gjs-vs$(VSVER)
+!endif
+
+TEST_PROGRAMS =
+
+# Enable Introspection
+!if "$(INTROSPECTION)" == "1"
+CHECK_PACKAGE = $(GJS_INTROSPECTION_CHECK_PACKAGE)
+EXTRA_TARGETS = vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.gir vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib
+!else
+EXTRA_TARGETS =
+!endif
+
+# Put together the CFLAGS
+LIBGJS_CFLAGS_BASE =                   \
+       $(GJS_DEFINES)                  \
+       $(MOZ_BUG_WORKAROUND_CFLAG)     \
+       /DGJS_COMPILATION               \
+       /DXP_WIN                        \
+       /DWIN32                         \
+       $(GJS_BASE_CFLAGS)              \
+       $(LIBGJS_DEP_INCLUDES)
+
+LIBGJS_CFLAGS = $(LIBGJS_CFLAGS_BASE) $(GJS_CFLAGS_WITH_LOG)
+
+GJS_CFLAGS =                           \
+       $(GJS_DEFINES)                  \
+       $(MOZ_BUG_WORKAROUND_CFLAG)     \
+       $(GJS_BASE_CFLAGS)              \
+       $(GJS_CFLAGS_WITH_LOG)          \
+       $(BASE_INCLUDES)
diff --git a/win32/config.h.win32.in b/win32/config.h.win32.in
new file mode 100644
index 00000000..8e3e1a8c
--- /dev/null
+++ b/win32/config.h.win32.in
@@ -0,0 +1,92 @@
+/* config.h.win32.in.  Handwritten, with generated version info from */
+/* configure.ac for Windows builds  */
+
+/* Note: This is passed into as CXXFLAGS in Visual Studio builds */
+/* Define if you want to build with cairo support */
+/* #undef ENABLE_CAIRO */
+
+/* Note: This is passed into as CXXFLAGS in Visual Studio builds */
+/* Define if you want to build with GTK+ support */
+/* #undef ENABLE_GTK */
+
+/* The gjs version as an integer */
+#define GJS_VERSION @GJS_VERSION@
+
+/* define if the compiler supports basic C++11 syntax */
+#define HAVE_CXX11 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if using dtrace probes. */
+/* #undef HAVE_DTRACE */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if printf() accepts '%Id' for alternative integer output */
+#define HAVE_PRINTF_ALTERNATIVE_INT 1
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+/* #undef HAVE_READLINE_READLINE_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#ifndef _MSC_VER
+#define HAVE_STRINGS_H 1
+#endif
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/signal.h> header file. */
+/* #undef HAVE_SYS_SIGNAL_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#ifndef _MSC_VER
+#define HAVE_UNISTD_H 1
+#endif
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "@PACKAGE@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "@PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "@PACKAGE_NAME@ @PACKAGE_VERSION@"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "@PACKAGE_VERSION@"
diff --git a/win32/create-lists-msvc.mak b/win32/create-lists-msvc.mak
new file mode 100644
index 00000000..2f719882
--- /dev/null
+++ b/win32/create-lists-msvc.mak
@@ -0,0 +1,107 @@
+# Convert the source listing to object (.obj) listing in
+# another NMake Makefile module, include it, and clean it up.
+# This is a "fact-of-life" regarding NMake Makefiles...
+# This file does not need to be changed unless one is maintaining the NMake Makefiles
+
+# For those wanting to add things here:
+# To add a list, do the following:
+# # $(description_of_list)
+# if [call create-lists.bat header $(makefile_snippet_file) $(variable_name)]
+# endif
+#
+# if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]
+# endif
+#
+# if [call create-lists.bat footer $(makefile_snippet_file)]
+# endif
+# ... (repeat the if [call ...] lines in the above order if needed)
+# !include $(makefile_snippet_file)
+#
+# (add the following after checking the entries in $(makefile_snippet_file) is correct)
+# (the batch script appends to $(makefile_snippet_file), you will need to clear the file unless the 
following line is added)
+#!if [del /f /q $(makefile_snippet_file)]
+#!endif
+
+# In order to obtain the .obj filename that is needed for NMake Makefiles to build DLLs/static LIBs or EXEs, 
do the following
+# instead when doing 'if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]'
+# (repeat if there are multiple $(srcext)'s in $(source_list), ignore any headers):
+# !if [for %c in ($(source_list)) do @if "%~xc" == ".$(srcext)" @call create-lists.bat file 
$(makefile_snippet_file) $(intdir)\%~nc.obj]
+#
+# $(intdir)\%~nc.obj needs to correspond to the rules added in build-rules-msvc.mak
+# %~xc gives the file extension of a given file, %c in this case, so if %c is a.cc, %~xc means .cc
+# %~nc gives the file name of a given file without extension, %c in this case, so if %c is a.cc, %~nc means a
+
+NULL=
+
+# For libgjs
+
+!if [call create-lists.bat header gjs_objs.mak libgjs_dll_OBJS]
+!endif
+
+!if [for %c in ($(LIBGJS_SOURCES)) do @if "%~xc" == ".cpp" @call create-lists.bat file gjs_objs.mak 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\libgjs\%~nc.obj]
+!endif
+
+!if [for %c in ($(LIBGJS_SOURCES)) do @if "%~xc" == ".c" @call create-lists.bat file gjs_objs.mak 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\libgjs\%~nc.obj]
+!endif
+
+!if [for %c in ($(module_resource_srcs)) do @if "%~xc" == ".c" @call create-lists.bat file gjs_objs.mak 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\libgjs\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gjs_objs.mak]
+!endif
+
+!if [call create-lists.bat header gjs_objs.mak gjs_OBJS]
+!endif
+
+!if [for %c in ($(gjs_console_srcs)) do @if "%~xc" == ".cpp" @call create-lists.bat file gjs_objs.mak 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\gjs-console\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gjs_objs.mak]
+!endif
+
+!include gjs_objs.mak
+
+!if [del /f /q gjs_objs.mak]
+!endif
+
+# For module-resources
+!if [call create-lists.bat header gjs_modules_objs.mak module_resources_generated_srcs]
+!endif
+
+!if [for %c in ($(module_resource_srcs)) do @call create-lists.bat file gjs_modules_objs.mak 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\module-resources\%c]
+!endif
+
+!if [call create-lists.bat footer gjs_modules_objs.mak]
+!endif
+
+!if [call create-lists.bat header gjs_modules_objs.mak module_system_OBJS]
+!endif
+
+!if [for %c in ($(module_system_srcs)) do @if "%~xc" == ".cpp" @call create-lists.bat file 
gjs_modules_objs.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\module-system\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gjs_modules_objs.mak]
+!endif
+
+!if [call create-lists.bat header gjs_modules_objs.mak module_console_OBJS]
+!endif
+
+!if [for %c in ($(module_console_srcs)) do @if "%~xc" == ".cpp" @call create-lists.bat file 
gjs_modules_objs.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\module-console\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gjs_modules_objs.mak]
+!endif
+
+!if [call create-lists.bat header gjs_modules_objs.mak module_cairo_OBJS]
+!endif
+
+!if [for %c in ($(module_cairo_srcs)) do @if "%~xc" == ".cpp" @call create-lists.bat file 
gjs_modules_objs.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\module-cairo\%~nc.obj]
+!endif
+
+!if [call create-lists.bat footer gjs_modules_objs.mak]
+!endif
+
+!include gjs_modules_objs.mak
+
+!if [del /f /q gjs_modules_objs.mak]
+!endif
diff --git a/win32/create-lists.bat b/win32/create-lists.bat
new file mode 100644
index 00000000..ef60d5ce
--- /dev/null
+++ b/win32/create-lists.bat
@@ -0,0 +1,42 @@
+@echo off
+rem Simple .bat script for creating the NMake Makefile snippets.
+
+if not "%1" == "header" if not "%1" == "file" if not "%1" == "footer" goto :error_cmd
+if "%2" == "" goto error_no_destfile
+
+if "%1" == "header" goto :header
+if "%1" == "file" goto :addfile
+if "%1" == "footer" goto :footer
+
+:header
+if "%3" == "" goto error_var
+echo %3 =      \>>%2
+goto done
+
+:addfile
+if "%3" == "" goto error_file
+echo.  %3      \>>%2
+goto done
+
+:footer
+echo.  $(NULL)>>%2
+echo.>>%2
+goto done
+
+:error_cmd
+echo Specified command '%1' was invalid.  Valid commands are: header file footer.
+goto done
+
+:error_no_destfile
+echo Destination NMake snippet file must be specified
+goto done
+
+:error_var
+echo A name must be specified for using '%1'.
+goto done
+
+:error_file
+echo A file must be specified for using '%1'.
+goto done
+
+:done
\ No newline at end of file
diff --git a/win32/detectenv-msvc.mak b/win32/detectenv-msvc.mak
new file mode 100644
index 00000000..aef99edc
--- /dev/null
+++ b/win32/detectenv-msvc.mak
@@ -0,0 +1,150 @@
+# Change this (or specify PREFIX= when invoking this NMake Makefile) if
+# necessary, so that the libs and headers of the dependent third-party
+# libraries can be located.  For instance, if building from GLib's
+# included Visual Studio projects, this should be able to locate the GLib
+# build out-of-the-box if they were not moved.  GLib's headers will be
+# found in $(GLIB_PREFIX)\include\glib-2.0 and
+# $(GLIB_PREFIX)\lib\glib-2.0\include and its import library will be found
+# in $(GLIB_PREFIX)\lib.
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+# Location of the PERL interpreter, for running glib-mkenums.  glib-mkenums
+# needs to be found in $(PREFIX)\bin.  Using either a 32-bit or x64 PERL
+# interpreter are supported for either a 32-bit or x64 build.
+
+!if "$(PERL)" == ""
+PERL = perl
+!endif
+
+# Location of the Python interpreter, for building introspection.  The complete set
+# of Python Modules for introspection (the giscanner Python scripts and the _giscanner.pyd
+# compiled module) needs to be found in $(PREFIX)\lib\gobject-introspection\giscanner, and
+# the g-ir-scanner Python script and g-ir-compiler utility program needs to be found
+# in $(PREFIX)\bin, together with any DLLs they will depend on, if those DLLs are not already
+# in your PATH.
+# Note that the Python interpreter and the introspection modules and utility progam must
+# correspond to the build type (i.e. 32-bit Release for 32-bit Release builds, and so on).
+#
+# For introspection, currently only Python 2.7.x is supported.  This may change when Python 3.x
+# support is added upstream in gobject-introspection--when this happens, the _giscanner.pyd must
+# be the one that is built against the release series of Python that is used here.
+
+!if "$(PYTHON)" == ""
+PYTHON = python
+!endif
+
+# Location of the pkg-config utility program, for building introspection.  It needs to be able
+# to find the pkg-config (.pc) files so that the correct libraries and headers for the needed libraries
+# can be located, using PKG_CONFIG_PATH.  Using either a 32-bit or x64 pkg-config are supported for
+# either a 32-bit or x64 build.
+
+!if "$(PKG_CONFIG)" == ""
+PKG_CONFIG = pkg-config
+!endif
+
+# The items below this line should not be changed, unless one is maintaining
+# the NMake Makefiles.  The exception is for the CFLAGS_ADD line(s) where one
+# could use his/her desired compiler optimization flags, if he/she knows what is
+# being done.
+
+# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
+# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
+!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
+MSG = ^
+This Makefile is only for Visual Studio 2008 and later.^
+You need to ensure that the Visual Studio Environment is properly set up^
+before running this Makefile.
+!error $(MSG)
+!endif
+
+ERRNUL  = 2>NUL
+_HASH=^#
+
+!if ![echo VCVERSION=_MSC_VER > vercl.x] \
+    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
+    && ![echo PLAT=Win32 >> vercl.x] \
+    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
+    && ![echo PLAT=x64 >> vercl.x] \
+    && ![echo $(_HASH)endif >> vercl.x] \
+    && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
+!include vercl.i
+!if ![echo VCVER= ^\> vercl.vc] \
+    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
+!include vercl.vc
+!endif
+!endif
+!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
+!endif
+
+!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
+VSVER = 9
+!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
+VSVER = 10
+!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
+VSVER = 11
+!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
+VSVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 1910
+VSVER = 14
+!elseif $(VCVERSION) > 1909 && $(VCVERSION) < 1920
+VSVER = 15
+!elseif $(VCVERSION) > 1919 && $(VCVERSION) < 2000
+VSVER = 16
+!else
+VSVER = 0
+!endif
+
+# Visual Studio 2015, 2017 and 2019 link to the vc140 C/C++ runtimes,
+# so we get a vc140.pdb for all these builds.
+!if $(VSVER) < 15
+PDBVER = $(VSVER)
+!else
+PDBVER = 14
+!endif
+
+!if "$(VSVER)" == "0"
+MSG = ^
+This NMake Makefile set supports Visual Studio^
+9 (2008) through 14 (2015).  Your Visual Studio^
+version is not supported.
+!error $(MSG)
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "Release" || "$(CFG)" == "debug" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+# One may change these items, but be sure to test
+# the resulting binaries
+!if "$(CFG)" == "release" || "$(CFG)" == "Release"
+CFLAGS_ADD = /MD /O2 /GL /MP
+!if "$(VSVER)" != "9"
+CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+
+!endif
+!else
+CFLAGS_ADD = /MDd /Od
+!endif
+
+!if "$(PLAT)" == "x64"
+LDFLAGS_ARCH = /machine:x64
+!else
+LDFLAGS_ARCH = /machine:x86
+!endif
+
+!if "$(VALID_CFGSET)" == "TRUE"
+CFLAGS = $(CFLAGS_ADD) /W3 /Zi
+
+LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib /DEBUG
+
+!if "$(CFG)" == "debug" || "$(CFG)" == "Debug"
+ARFLAGS = $(LDFLAGS_ARCH)
+LDFLAGS = $(LDFLAGS_BASE)
+!else
+ARFLAGS = $(LDFLAGS_ARCH) /LTCG
+LDFLAGS = $(LDFLAGS_BASE) /LTCG /opt:ref
+!endif
+!endif
diff --git a/win32/generate-msvc.mak b/win32/generate-msvc.mak
new file mode 100644
index 00000000..c4588b02
--- /dev/null
+++ b/win32/generate-msvc.mak
@@ -0,0 +1,24 @@
+# NMake Makefile portion for code generation and
+# intermediate build directory creation
+# Items in here should not need to be edited unless
+# one is maintaining the NMake build files.
+
+# Copy the pre-defined config.h.win32
+vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\config.h: config.h.win32 vs$(VSVER)\$(CFG)\$(PLAT)\libgjs
+       @-copy $(@B).h.win32 $@
+
+# Create the build directories
+vs$(VSVER)\$(CFG)\$(PLAT)\module-console       \
+vs$(VSVER)\$(CFG)\$(PLAT)\module-system        \
+vs$(VSVER)\$(CFG)\$(PLAT)\module-resources     \
+vs$(VSVER)\$(CFG)\$(PLAT)\module-cairo \
+vs$(VSVER)\$(CFG)\$(PLAT)\libgjs               \
+vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console:
+       @-mkdir $@
+
+# Generate the GResource sources
+vs$(VSVER)\$(CFG)\$(PLAT)\module-resources\modules-resources.h \
+vs$(VSVER)\$(CFG)\$(PLAT)\module-resources\modules-resources.c: ..\modules\modules.gresource.xml
+       $(PREFIX)\bin\glib-compile-resources.exe --target=$@    \
+       --sourcedir=.. --generate --c-name modules_resources    \
+       $**
diff --git a/win32/gjs-introspection-msvc.mak b/win32/gjs-introspection-msvc.mak
new file mode 100644
index 00000000..b772ea26
--- /dev/null
+++ b/win32/gjs-introspection-msvc.mak
@@ -0,0 +1,34 @@
+
+!if "$(BUILD_INTROSPECTION)" == "TRUE"
+# Create the file list for introspection (to avoid the dreaded command-line-too-long problem on Windows)
+vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\gjs_private_list:
+       @for %f in ($(LIBGJS_PRIVATE_SOURCES)) do @echo ../%f >> $@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.gir: vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib 
vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\gjs_private_list
+       @-echo Generating $@...
+       $(PYTHON) $(G_IR_SCANNER)                       \
+       --verbose -no-libtool                           \
+       --identifier-prefix=Gjs                         \
+       --symbol-prefix=gjs_                            \
+       --warn-all                                      \
+       --namespace=GjsPrivate                  \
+       --nsversion=1.0                                 \
+       $(INTROSPECTION_INCLUDE_PACKAGES)               \
+       --library=gjs                                   \
+       --add-include-path=$(G_IR_INCLUDEDIR)           \
+       --pkg-export=gjs                                \
+       --cflags-begin                                  \
+       $(LIBGJS_CFLAGS_BASE)                           \
+       --cflags-end                                    \
+       --filelist=vs$(VSVER)\$(CFG)\$(PLAT)\libgjs\gjs_private_list    \
+       -L.\vs$(VSVER)\$(CFG)\$(PLAT)   \
+       -o $@
+
+vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib: vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.gir
+       $(PREFIX)\bin\g-ir-compiler                     \
+       --includedir=vs$(VSVER)\$(CFG)\$(PLAT) --debug --verbose        \
+       $(**:\=/)                                       \
+       -o $@
+!else
+!error $(ERROR_MSG)
+!endif
diff --git a/win32/info-msvc.mak b/win32/info-msvc.mak
new file mode 100644
index 00000000..44473bf1
--- /dev/null
+++ b/win32/info-msvc.mak
@@ -0,0 +1,93 @@
+# NMake Makefile portion for displaying config info
+
+GTK_SUPPORT = yes
+CAIRO_SUPPORT = yes
+
+!if "$(NO_CAIRO)" == "1"
+CAIRO_SUPPORT = no
+!endif
+
+!if "$(NO_GTK)" == "1"
+GTK_SUPPORT = no
+!endif
+
+!if "$(INTROSPECTION)" == "1"
+BUILD_INTROSPECTION = yes
+!else
+BUILD_INTROSPECTION = no
+!endif
+
+!if "$(CFG)" == "release"
+BUILD_TYPE = release
+!else
+BUILD_TYPE = debug
+!endif
+
+build-info-gjs:
+       @echo.
+       @echo =====================
+       @echo Configuration for GJS
+       @echo =====================
+       @echo GTK+ support: $(GTK_SUPPORT)
+       @echo Cairo support: $(CAIRO_SUPPORT)
+
+all-build-info: build-info-gjs
+       @echo.
+       @echo ----------------
+       @echo Other build info
+       @echo ----------------
+       @echo Build Type: $(BUILD_TYPE)
+       @echo Introspection: $(BUILD_INTROSPECTION)
+
+help:
+       @echo.
+       @echo ========================
+       @echo Building gjs Using NMake
+       @echo ========================
+       @echo nmake /f Makefile.vc CFG=[release^|debug] ^<PREFIX=PATH^> OPTION=1 ...
+       @echo.
+       @echo Where:
+       @echo ------
+       @echo CFG: Required, use CFG=release for an optimized build and CFG=debug
+       @echo for a debug build.  PDB files are generated for all builds.
+       @echo.
+       @echo PREFIX: Optional, the path where dependent libraries and tools may be
+       @echo found, default is ^$(srcrootdir)\..\vs^$(short_vs_ver)\^$(platform),
+       @echo where ^$(short_vs_ver) is 12 for VS 2013, 14 for VS 2015 and so on; and
+       @echo ^$(platform) is Win32 for 32-bit builds and x64 for x64 builds.
+       @echo.
+       @echo OPTION: Optional, may be any of the following, use OPTION=1 to enable;
+       @echo multiple OPTION's may be used.  If no OPTION is specified, a default
+       @echo GJS is built with GTK+ and Cairo support, without the introspection
+       @echo files (this means the default build will depend on the GTK+-3.x libraries
+       @echo and the cairo/cairo-gobject libraries respectively).
+       @echo ======
+       @echo NO_CAIRO:
+       @echo Disable Cairo support.
+       @echo.
+       @echo NO_GTK:
+       @echo Disable GTK support.  For introspection, you will then only need the .pc
+       @echo files and .gir/.typelib files for Gio-2.0 and its dependencies; otherwise
+       @echo the gtk+-3.0.pc and Gtk-3.0.gir/Gtk-3.0.typelib files are required.
+       @echo.
+       @echo INTROSPECTION:
+       @echo Enable the build of introspection files requires the GNOME
+       @echo gobject-introspection libraries and tools.  You will need
+       @echo to ensure Python interpreter (that was used to build the
+       @echo gobject-introspection tools) can be found by setting PKG_CONFIG_PATH
+       @echo beforehand, and passing in PYTHON=^$(PATH_TO_PYTHON_INTERPRETOR)
+       @echo respectively, if python.exe is not already in your PATH.
+       @echo.
+       @echo LIBTOOL_DLL_NAME:
+       @echo Use a libtool-style DLL name to mimic the DLL file naming generated by
+       @echo MinGW/autotools builds.  Please note that this does not enable one to use
+       @echo this build with MinGW builds.
+       @echo ======
+       @echo A 'clean' target is supported to remove all generated files, intermediate
+       @echo object files and binaries for the specified configuration.
+       @echo.
+       @echo An 'install' target is supported to copy the build (DLLs, utility programs,
+       @echo LIBs, along with the introspection files if applicable) to appropriate
+       @echo locations under ^$(PREFIX).
+       @echo ======
+       @echo.
diff --git a/win32/install.mak b/win32/install.mak
new file mode 100644
index 00000000..907bfa84
--- /dev/null
+++ b/win32/install.mak
@@ -0,0 +1,18 @@
+# NMake Makefile snippet for copying the built libraries, utilities and headers to
+# a path under $(PREFIX).
+
+install: all
+       @if not exist $(PREFIX)\bin\ mkdir $(PREFIX)\bin
+       @if not exist $(PREFIX)\lib\ mkdir $(PREFIX)\lib
+       @if not exist $(PREFIX)\include\gjs-1.0\gjs @mkdir $(PREFIX)\include\gjs-1.0\gjs
+       @if not exist $(PREFIX)\include\gjs-1.0\util @mkdir $(PREFIX)\include\gjs-1.0\util
+       @copy /b $(LIBGJS_DLL_FILENAME).dll $(PREFIX)\bin
+       @copy /b $(LIBGJS_DLL_FILENAME).pdb $(PREFIX)\bin
+       @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\gjs.lib $(PREFIX)\lib
+       @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console.exe $(PREFIX)\bin
+       @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console.exe $(PREFIX)\bin\gjs.exe
+       @copy /b vs$(VSVER)\$(CFG)\$(PLAT)\gjs-console.pdb $(PREFIX)\bin
+       @for %h in ($(LIBGJS_HEADERS)) do @copy ..\%h $(PREFIX)\include\gjs-1.0\%h
+       @rem Copy the generated introspection files, if built
+       @if exist vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib mkdir $(PREFIX)\lib\gjs\girepository-1.0
+       @if exist vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib copy /b 
vs$(VSVER)\$(CFG)\$(PLAT)\GjsPrivate-1.0.typelib $(PREFIX)\lib\gjs\girepository-1.0
diff --git a/win32/introspection-msvc.mak b/win32/introspection-msvc.mak
new file mode 100644
index 00000000..f587c6f0
--- /dev/null
+++ b/win32/introspection-msvc.mak
@@ -0,0 +1,73 @@
+# Common NMake Makefile module for checking the build environment is sane
+# for building introspection files under MSVC/NMake.
+# This can be copied from $(gi_srcroot)\build\win32 for GNOME items
+# that support MSVC builds and introspection under MSVC.
+
+# Can override with env vars as needed
+# You will need to have built gobject-introspection for this to work.
+# Change or pass in or set the following to suit your environment
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+# Note: The PYTHON must be the Python release series that was used to build
+# the GObject-introspection scanner Python module!
+# Either having python.exe your PATH will work or passing in
+# PYTHON=<full path to your Python interpreter> will do
+
+# This is required, and gobject-introspection needs to be built
+# before this can be successfully run.
+!if "$(PYTHON)" == ""
+PYTHON=python
+!endif
+
+# Don't change anything following this line!
+
+GIR_SUBDIR = share\gir-1.0
+GIR_TYPELIBDIR = lib\girepository-1.0
+G_IR_SCANNER = $(PREFIX)\bin\g-ir-scanner
+G_IR_COMPILER = $(PREFIX)\bin\g-ir-compiler.exe
+G_IR_INCLUDEDIR = $(PREFIX)\$(GIR_SUBDIR)
+G_IR_TYPELIBDIR = $(PREFIX)\$(GIR_TYPELIBDIR)
+
+VALID_PKG_CONFIG_PATH = FALSE
+
+MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH
+MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the 
Introspection Files
+
+ERROR_MSG =
+
+BUILD_INTROSPECTION = TRUE
+
+!if ![pkg-config --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x]     \
+       && ![setlocal]  \
+       && ![set file="pkgconfig.x"]    \
+       && ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize]       \
+       && ![del $(ERRNUL) /q/f pkgconfig.x]
+!endif
+
+!include pkgconfig.chksize
+!if "$(PKG_CHECK_SIZE)" == "0"
+VALID_PKG_CONFIG_PATH = TRUE
+!else
+VALID_PKG_CONFIG_PATH = FALSE
+!endif
+
+!if ![del $(ERRNUL) /q/f pkgconfig.chksize]
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "Release" || "$(CFG)" == "debug" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_PKGCONFIG)
+!endif
+
+!if "$(VALID_CFGSET)" != "TRUE"
+BUILD_INTROSPECTION = FALSE
+ERROR_MSG = $(MSG_INVALID_CFG)
+!endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]