[pangomm/pangomm-2-42] NMake Makefiles: Allow builds from a GIT checkout



commit 4b224135ab90c65fbeb25695142525d8680eedbb
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Feb 27 16:16:53 2020 +0800

    NMake Makefiles: Allow builds from a GIT checkout
    
    ...or a Meson-generated release tarball.
    
    Add targets to the NMake Makefiles which will allow:
    
    -Generating MSVC_NMake/pangomm/pangommconfig.h and
     MSVC_NMake/pangomm/pangomm.rc, needed for GIT checkouts and
     Meson-generated release tarballs
    
    -Generating the sources that need to be generated with gmmproc and
     generate_wrap_init.pl, needed for GIT checkouts, and fix installation
     accordingly.
    
    -Look for sources also in $(srcroot)/untracked, which will be the case
     for Meson-generated release tarballs.

 MSVC_NMake/build-rules-msvc.mak  | 22 ++++++++++++++++++++++
 MSVC_NMake/config-msvc.mak       |  7 ++++++-
 MSVC_NMake/create-lists-msvc.mak |  9 +++++++++
 MSVC_NMake/generate-msvc.mak     |  9 +++++++--
 MSVC_NMake/install.mak           |  8 ++++++--
 README.win32                     | 26 ++++++++++++++++++++++++++
 6 files changed, 76 insertions(+), 5 deletions(-)
---
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index 644745a..39ec259 100644
--- a/MSVC_NMake/build-rules-msvc.mak
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -13,11 +13,27 @@
 #      $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
 # $<
 # <<
+{$(CFG)\$(PLAT)\pangomm\}.cc{$(CFG)\$(PLAT)\pangomm\}.obj::
+       $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(CFG)\$(PLAT)\pangomm\ /c @<<
+$<
+<<
+
+{..\untracked\pango\pangomm\}.cc{$(CFG)\$(PLAT)\pangomm\}.obj::
+       $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(CFG)\$(PLAT)\pangomm\ /c @<<
+$<
+<<
+
 {..\pango\pangomm\}.cc{$(CFG)\$(PLAT)\pangomm\}.obj::
        $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(CFG)\$(PLAT)\pangomm\ /c @<<
 $<
 <<
 
+{..\pango\src\}.ccg{$(CFG)\$(PLAT)\pangomm\}.obj:
+       @if not exist $(@D)\private\ $(MAKE) /f Makefile.vc CFG=$(CFG) $(@D)\private
+       @for %%s in ($(<D)\*.ccg) do @if not exist ..\pango\pangomm\%%~ns.cc if not exist $(@D)\%%~ns.cc 
$(PERL) -- $(GMMPROC_DIR)/gmmproc -I ../tools/m4 --defs $(<D:\=/) %%~ns $(<D:\=/) $(@D)
+       @if exist $(@D)\$(<B).cc $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /c $(@D)\$(<B).cc
+       @if exist ..\pango\pangomm\$(<B).cc $(CXX) $(PANGOMM_CFLAGS) $(CFLAGS_NOGL) /Fo$(@D)\ /c 
..\pango\pangomm\$(<B).cc
+
 {.\pangomm\}.rc{$(CFG)\$(PLAT)\pangomm\}.res:
        rc /fo$@ $<
 
@@ -60,8 +76,14 @@ clean:
        @-del /f /q $(CFG)\$(PLAT)\pangomm\*.def
        @-del /f /q $(CFG)\$(PLAT)\pangomm\*.res
        @-del /f /q $(CFG)\$(PLAT)\pangomm\*.obj
+       @-del /f /q $(CFG)\$(PLAT)\pangomm\private\*.h
+       @-del /f /q $(CFG)\$(PLAT)\pangomm\*.h
+       @-del /f /q $(CFG)\$(PLAT)\pangomm\*.cc
        @-del /f /q $(CFG)\$(PLAT)\gendef\*.obj
+       @-rd $(CFG)\$(PLAT)\pangomm\private
        @-rd $(CFG)\$(PLAT)\pangomm
        @-rd $(CFG)\$(PLAT)\gendef
        @-del pkg-ver.mak
        @-del /f /q vc$(PDBVER)0.pdb
+
+.SUFFIXES: .cc .h .ccg .hg .obj
diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak
index 961042d..f355886 100644
--- a/MSVC_NMake/config-msvc.mak
+++ b/MSVC_NMake/config-msvc.mak
@@ -25,8 +25,13 @@ DEBUG_SUFFIX = -d
 DEBUG_SUFFIX =
 !endif
 
+!ifndef GMMPROC_DIR
+GMMPROC_DIR=$(PREFIX)\share\glibmm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)\proc
+!endif
+
 PANGOMM_BASE_CFLAGS =                  \
-       /I..\pango /I.\pangomm          \
+       /I$(CFG)\$(PLAT)        \
+       /I..\pango /I..\pango\pangomm /I.\pangomm               \
        /wd4530 /EHsc   \
        /FImsvc_recommended_pragmas.h
 
diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak
index 3622459..48bba62 100644
--- a/MSVC_NMake/create-lists-msvc.mak
+++ b/MSVC_NMake/create-lists-msvc.mak
@@ -54,6 +54,15 @@ files_extra_ph_int = $(files_extra_ph:/=\)
 !if [call create-lists.bat footer pangomm.mak]
 !endif
 
+!if [call create-lists.bat header pangomm.mak pangomm_real_hg]
+!endif
+
+!if [for %c in ($(files_hg)) do @call create-lists.bat file pangomm.mak ..\pango\src\%c]
+!endif
+
+!if [call create-lists.bat footer pangomm.mak]
+!endif
+
 !include pangomm.mak
 
 !if [del /f /q pangomm.mak]
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
index f135ad5..2c46858 100644
--- a/MSVC_NMake/generate-msvc.mak
+++ b/MSVC_NMake/generate-msvc.mak
@@ -5,13 +5,18 @@
 
 # Create the build directories
 $(CFG)\$(PLAT)\gendef  \
-$(CFG)\$(PLAT)\pangomm:
-       @-mkdir $@
+$(CFG)\$(PLAT)\pangomm \
+$(CFG)\$(PLAT)\pangomm\private:
+       @-md $@
 
 # Generate .def files
 $(CFG)\$(PLAT)\pangomm\pangomm.def: $(GENDEF) $(CFG)\$(PLAT)\pangomm $(pangomm_OBJS)
        $(CFG)\$(PLAT)\gendef.exe $@ $(PANGOMM_LIBNAME) $(CFG)\$(PLAT)\pangomm\*.obj
 
+# Generate wrap_init.cc files
+$(CFG)\$(PLAT)\pangomm\wrap_init.cc: $(pangomm_real_hg)
+       @if not exist ..\pango\pangomm\wrap_init.cc $(PERL) -- "$(GMMPROC_DIR)/generate_wrap_init.pl" 
--namespace=Pango --parent_dir=pangomm $(pangomm_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 pangomm\pangomm.rc 
pangomm\pangommconfig.h
diff --git a/MSVC_NMake/install.mak b/MSVC_NMake/install.mak
index 5c06368..4b5f9bb 100644
--- a/MSVC_NMake/install.mak
+++ b/MSVC_NMake/install.mak
@@ -10,6 +10,10 @@ install: all
        @copy /b $(CFG)\$(PLAT)\$(PANGOMM_LIBNAME).lib $(PREFIX)\lib
        @copy ..\pango\pangomm.h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\"
        @for %h in ($(files_extra_h)) do @copy ..\pango\pangomm\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\%h"
-       @for %h in ($(files_built_h)) do @copy ..\pango\pangomm\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\%h"
-       @for %h in ($(PANGOMM_BUILD_PRIVATE_HEADERS)) do @copy ..\pango\pangomm\private\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\private\%h"
+       @for %h in ($(files_built_h)) do @if exist ..\untracked\pango\pangomm\%h copy 
..\untracked\pango\pangomm\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\%h"
+       @for %h in ($(files_built_h)) do @if exist ..\pango\pangomm\%h if not exist 
..\untracked\pango\pangomm\%h copy ..\pango\pangomm\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\%h"
+       @for %h in ($(files_built_h)) do @if exist $(CFG)\$(PLAT)\pangomm\%h copy $(CFG)\$(PLAT)\pangomm\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\%h"
+       @for %h in ($(files_built_h)) do @if exist ..\untracked\pango\pangomm\private\%h copy 
..\untracked\pango\pangomm\private\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\private\%h"
+       @for %h in ($(PANGOMM_BUILD_PRIVATE_HEADERS)) do @if exist ..\pango\pangomm\private\%h if not exist 
..\untracked\pango\pangomm\private\%h copy ..\pango\pangomm\private\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\private\%h"
+       @for %h in ($(PANGOMM_BUILD_PRIVATE_HEADERS)) do @if exist $(CFG)\$(PLAT)\pangomm\private\%h copy 
$(CFG)\$(PLAT)\pangomm\private\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\private\%h"
        @copy ".\pangomm\pangommconfig.h" 
"$(PREFIX)\lib\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\include\"
diff --git a/README.win32 b/README.win32
index 2a0a2a3..f3ffed0 100644
--- a/README.win32
+++ b/README.win32
@@ -61,6 +61,32 @@ intermediate files that are generated during the build, while an
 'install' target is supported to copy the built DLL and PDB, .lib and
 headers to their appropriate locations under $(PREFIX).
 
+The NMake Makefiles now support building the pangomm libraries directly from a GIT checkout
+with a few manual steps required, namely to:
+
+-Ensure that you have a copy of Cygwin or MSYS/MSYS64 installed, including
+ m4.exe and sh.exe.  You should also have a PERL for Windows installation
+ as well, and your PATH should contain the paths to your PERL interpreter
+ and the bin\ directory of your Cygwin or MSYS/MSYS64 installation, and
+ it is recommended that these paths are towards the end of your PATH.  You need
+ to install the XML::Parser PERL module as well, which requires libexpat.  You
+ may wish to pass in the directory where gmmproc and generate_wrap_init.pl
+ from glibmm is found, if they are not in $(PREFIX)\share\glibmm-2.4\proc.
+
+-Make a new copy of the entire source tree to some location, where the build
+ 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\pangomm\pangommconfig.h
+ --$(srcroot)\MSVC_NMake\pangomm\pangomm.rc
+
+For pangommconfig.h, it is recommended to keep PANGOMM_DISABLE_DEPRECATED
+undefined unless you know what you are doing.  If $(srcroot)\MSVC_NMake\pangomm\pangommconfig.h
+and/or $(srcroot)\MSVC_NMake\pangomm\pangomm.rc is missing from the release tarball, you may
+also generate them using nmake /f Makefile.vc CFG=[release|debug] prep-git-build.
+
+Note that the prep-git-build target will require a working PERL installation.
+
 3. Using Meson
 
 3.1 Meson with Visual Studio 2013 or later


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