[glibmm] NMake Makefiles: Add targets to ease build from GIT checkouts



commit 6482fefc463259bac07939c00e44512989bbfa9e
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Feb 26 18:59:02 2020 +0800

    NMake Makefiles: Add targets to ease build from GIT checkouts
    
    This will enable one to generate the following files:
    
    MSVC_NMake/glibmm/glibmmconfig.h
    MSVC_NMake/glibmm/glibmm.rc
    MSVC_NMake/giomm/giommconfig.h
    MSVC_NMake/giomm/giomm.rc
    
    when building from a GIT checkout.
    
    This will also enable one to generate the following files:
    tools/gmmproc
    tools/generate_wrap_init.pl
    
    from a GIT checkout or from a source tree unpacked from a release tarball so
    that one can use these to build directly from a GIT checkout using NMake,
    or to have gmmproc and generate_wrap_init.pl ready to use to build other
    -mm libraries.

 MSVC_NMake/Makefile.vc           |  4 +++
 MSVC_NMake/build-rules-msvc.mak  |  3 ++
 MSVC_NMake/create-lists-msvc.mak |  3 ++
 MSVC_NMake/generate-msvc.mak     | 74 ++++++++++++++++++++++++++++++++++++++++
 README.win32                     | 30 ++++++++--------
 5 files changed, 100 insertions(+), 14 deletions(-)
---
diff --git a/MSVC_NMake/Makefile.vc b/MSVC_NMake/Makefile.vc
index 7df11925..6defa6a8 100644
--- a/MSVC_NMake/Makefile.vc
+++ b/MSVC_NMake/Makefile.vc
@@ -37,6 +37,10 @@ VALID_MSC = TRUE
 # into the lists we need for compilation and introspection
 !include create-lists-msvc.mak
 
+!ifdef GENERATE_VERSIONED_FILES
+!include pkg-ver.mak
+!endif
+
 all: $(GIOMM_LIB) $(GLIBMM_EXTRA_DEFS_GEN_LIB) $(glibmm_ex) $(giomm_ex) all-build-info
 
 tests: $(glibmm_tests) $(giomm_tests) all-build-info
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index e1f78ad7..e01fd449 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -230,6 +230,9 @@ clean:
        @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk
        @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exp
        @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.lib
+       @-del pkg-ver.mak
+       @-del ..\tools\generate_wrap_init.pl
+       @-del ..\tools\gmmproc
        @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gschemas.compiled
        @-del vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\*.pdb
        @-del vs$(VSVER)\$(CFG)\$(PLAT)\glib-extra-defs-gen\*.obj
diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak
index 4044bb3b..b0ce441c 100644
--- a/MSVC_NMake/create-lists-msvc.mak
+++ b/MSVC_NMake/create-lists-msvc.mak
@@ -144,6 +144,9 @@ glibmm_files_extra_ph_int = $(glibmm_files_extra_ph:/=\)
 !if [call create-lists.bat footer glibmm.mak]
 !endif
 
+!if [for %d in ($(PREFIX)) do @echo PREFIX_REAL=%~dpnd>>glibmm.mak]
+!endif
+
 !include glibmm.mak
 
 !if [del /f /q glibmm.mak]
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
index aa4b16b9..fce7b044 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -33,3 +33,77 @@ vs$(VSVER)\$(CFG)\$(PLAT)\glibmm\wrap_init.cc: $(glibmm_real_hg)
 
 vs$(VSVER)\$(CFG)\$(PLAT)\giomm\wrap_init.cc: $(giomm_real_hg)
        @if not exist ..\gio\giomm\wrap_init.cc $(PERL) -- "../tools/generate_wrap_init.pl" --namespace=Gio 
--parent_dir=giomm $(giomm_real_hg:\=/)>$@
+
+# Generate pre-generated resources and configuration headers (builds from GIT)
+prep-git-build: pkg-ver.mak
+       $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 glibmm\glibmm.rc giomm\giomm.rc 
giomm\giommconfig.h
+       $(MAKE) /f Makefile.vc CFG=$(CFG) gen-perl-scripts-real
+
+gen-perl-scripts-real: pkg-ver.mak
+       $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 ..\tools\gmmproc 
..\tools\generate_wrap_init.pl
+
+glibmm\glibmm.rc: pkg-ver.mak glibmm\glibmm.rc.in glibmm\glibmmconfig.h
+       @echo Generating $@...
+       @copy $@.in $@
+       @$(PERL) -pi.bak -e "s/\@GLIBMM_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@GLIBMM_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@GLIBMM_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@PACKAGE_VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@GLIBMM_MODULE_NAME\@/glibmm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)/g" $@
+       @del $@.bak
+
+glibmm\glibmmconfig.h: ..\glib\glibmmconfig.h.in
+       @echo Copying $@ from $**...
+       @copy $** $@
+
+giomm\giomm.rc: pkg-ver.mak
+       @echo Generating $@...
+       @copy $@.in $@
+       @$(PERL) -pi.bak -e "s/\@GIOMM_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@GIOMM_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@GIOMM_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@PACKAGE_VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@GIOMM_MODULE_NAME\@/giomm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)/g" 
$@
+       @del $@.bak
+
+# You may change GIOMM_DISABLE_DEPRECATED and GIOMM_STATIC_LIB if you know what you are doing
+giomm\giommconfig.h: pkg-ver.mak ..\gio\giommconfig.h.in
+       @echo Generating $@...
+       @copy ..\gio\$(@F).in $@
+       @$(PERL) -pi.bak -e "s/\#undef GIOMM_DISABLE_DEPRECATED/\/\* \#undef GIOMM_DISABLE_DEPRECATED \*\//g" 
$@
+       @$(PERL) -pi.bak -e "s/\#undef GIOMM_STATIC_LIB/\/\* \#undef GIOMM_STATIC_LIB \*\//g" $@
+       @$(PERL) -pi.bak -e "s/\#undef GIOMM_MAJOR_VERSION/\#define GIOMM_MAJOR_VERSION 
$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\#undef GIOMM_MINOR_VERSION/\#define GIOMM_MINOR_VERSION 
$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\#undef GIOMM_MICRO_VERSION/\#define GIOMM_MICRO_VERSION 
$(PKG_MICRO_VERSION)/g" $@
+       @del $@.bak
+
+..\tools\gmmproc: ..\tools\gmmproc.in
+       @echo Generating $@...
+       @copy $** $@
+       @$(PERL) -pi.bak -e "s/\@PERL\@/$(PERL:\=\/)/g" $@
+       @$(PERL) -pi.bak -e "s/\@prefix\@/$(PREFIX_REAL:\=\/)/g" $@
+       @$(PERL) -pi.bak -e "s/\@exec_prefix\@/$(PREFIX_REAL:\=\/)/g" $@
+       @$(PERL) -pi.bak -e "s/\@libdir\@/$(PREFIX_REAL:\=\/)\/share/g" $@
+       @$(PERL) -pi.bak -e "s/\@M4\@/$(M4:\=\/)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@GLIBMM_MODULE_NAME\@/giomm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@PACKAGE_VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@
+       @del $@.bak
+
+..\tools\generate_wrap_init.pl: ..\tools\generate_wrap_init.pl.in
+       @echo Generating $@...
+       @copy $** $@
+       @$(PERL) -pi.bak -e "s/\@PERL\@/$(PERL:\=\/)/g" $@
+       @del $@.bak
+
+pkg-ver.mak: ..\configure.ac
+       @echo Generating version info Makefile Snippet...
+       @$(PERL) -00 -ne "print if /AC_INIT\(/" $** |   \
+       $(PERL) -pe "tr/, /\n/s" |      \
+       $(PERL) -ne "print if 2 .. 2" | \
+       $(PERL) -ne "print /\[(.*)\]/" > ver.txt
+       @echo @echo off>pkg-ver.bat
+       @echo.>>pkg-ver.bat
+       @echo set /p glibmm_ver=^<ver.txt>>pkg-ver.bat
+       @echo for /f "tokens=1,2,3 delims=." %%%%a IN ("%glibmm_ver%") do (echo PKG_MAJOR_VERSION=%%%%a^& 
echo PKG_MINOR_VERSION=%%%%b^& echo PKG_MICRO_VERSION=%%%%c)^>$@>>pkg-ver.bat
+       @pkg-ver.bat
+       @del ver.txt pkg-ver.bat
diff --git a/README.win32 b/README.win32
index 440271f6..700aeaf2 100644
--- a/README.win32
+++ b/README.win32
@@ -73,22 +73,24 @@ with a few manual steps required, namely to:
  to install the XML::Parser PERL module as well, which requires libexpat.
 
 -Make a new copy of the entire source tree to some location, where the build
- is to be done; then:
---Copy $(srcroot)\glib\glibmmconfig.h.in to $(srcroot)\MSVC_NMake\glibmm\glibmmconfig.h
---Copy $(srcroot)\gio\giommconfig.h.in to $(srcroot)\MSVC_NMake\giomm\giommconfig.h
---Copy $(srcroot)\MSVC_NMake\glibmm\glibmm.rc.in to $(srcroot)\MSVC_NMake\glibmm\glibmm.rc
---Copy $(srcroot)\MSVC_NMake\giomm\giomm.rc.in to $(srcroot)\MSVC_NMake\giomm\giomm.rc
---Copy $(srcroot)\tools\gmmproc.in to $(srcroot)\tools\gmmproc
---Copy $(srcroot)\tools\generate_wrap_init.pl.in to $(srcroot)\tools\generate_wrap_init.pl
-
-After copying the above 6 files, you need to ensure that they reflect on the package version
-that best matches your checkout status and the paths in $(srcroot)\tools\gmmproc and
-$(srcroot)\tools\generate_wrap_init.pl (the items enclosed between the @...@'s) should reflect
-on where you intend for nmake /f Makefile.vc CFG=$(CFG) install to install to (i.e. $(PREFIX)).
+ is to be done; then in $(srcroot)\MSVC_NMake run
+ nmake /f Makefile.vc CFG=[release|debug] prep-git-build, which will copy and generate
+ the following files with the proper info:
+ --$(srcroot)\MSVC_NMake\glibmm\glibmmconfig.h
+ --$(srcroot)\MSVC_NMake\giomm\giommconfig.h
+ --$(srcroot)\MSVC_NMake\glibmm\glibmm.rc
+ --$(srcroot)\MSVC_NMake\giomm\giomm.rc
+ --$(srcroot)\tools\gmmproc
+ --$(srcroot)\tools\generate_wrap_init.pl
+
 For giommconfig.h, it is recommended to keep GIOMM_STATIC_LIB and GIOMM_DISABLE_DEPRECATED
 undefined unless you know what you are doing (remember, the NMake Makefiles only support DLL
-builds out-of-the-box).  You may ignore the fields in glibmmconfig.h the values between
-#ifdef GLIBMM_CONFIGURE and #endif /* GLIBMM_CONFIGURE */.
+builds out-of-the-box).  For builds from the release tarballs, running
+nmake /f Makefile.vc CFG=[release|debug] gen-perl-scripts-real will also generate
+$(srcroot)\tools\gmmproc and $(srcroot)\tools\generate_wrap_init.pl for you.
+
+Note that the prep-git-build and the gen-perl-scripts-real targets will require a working PERL
+installation.
 
 3. Glibmm methods and signals not available on win32
 


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