[pangomm] NMake Makefiles: Allow builds from a GIT checkout



commit 473e759ba96f4c003333a77a38ddb0ee74338ea6
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.
    
    -"Install" the m4 files in tools/m4, so that other projects may use it.

 MSVC_NMake/build-rules-msvc.mak  | 22 ++++++++++++++++++++++
 MSVC_NMake/config-msvc.mak       |  3 ++-
 MSVC_NMake/create-lists-msvc.mak |  9 +++++++++
 MSVC_NMake/generate-msvc.mak     |  9 +++++++--
 MSVC_NMake/install.mak           | 10 ++++++++--
 README.win32                     | 26 ++++++++++++++++++++++++++
 6 files changed, 74 insertions(+), 5 deletions(-)
---
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
index b9a889b..2a61506 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) $(LIBPANGOMM_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$@ $<
 
@@ -61,8 +77,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 080259f..81e44fc 100644
--- a/MSVC_NMake/config-msvc.mak
+++ b/MSVC_NMake/config-msvc.mak
@@ -25,7 +25,8 @@ DEBUG_SUFFIX =
 !endif
 
 PANGOMM_BASE_CFLAGS =          \
-       /I..\pango /I.\pangomm  \
+       /I$(CFG)\$(PLAT)        \
+       /I..\pango /I..\pango\pangomm /I.\pangomm               \
        /wd4530 /std:c++17      \
        /FImsvc_recommended_pragmas.h
 
diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak
index cdd52e4..49289c7 100644
--- a/MSVC_NMake/create-lists-msvc.mak
+++ b/MSVC_NMake/create-lists-msvc.mak
@@ -52,6 +52,15 @@ pangomm_generated_private_headers = $(files_hg:.hg=_p.h)
 !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 47bb220..5b0e6bf 100644
--- a/MSVC_NMake/install.mak
+++ b/MSVC_NMake/install.mak
@@ -5,10 +5,16 @@ install: all
        @if not exist $(PREFIX)\bin\ mkdir $(PREFIX)\bin
        @if not exist $(PREFIX)\lib\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\include\ mkdir 
$(PREFIX)\lib\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\include
        @if not exist 
$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\private\ @mkdir 
$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\private
+       @if not exist $(PREFIX)\share\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\proc\m4\ 
@mkdir $(PREFIX)\share\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\proc\m4
        @copy /b $(CFG)\$(PLAT)\$(PANGOMM_LIBNAME).dll $(PREFIX)\bin
        @copy /b $(CFG)\$(PLAT)\$(PANGOMM_LIBNAME).pdb $(PREFIX)\bin
        @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_built_h) $(files_extra_h)) do @copy ..\pango\pangomm\%h 
"$(PREFIX)\include\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\pangomm\%h"
-       @for %h in ($(pangomm_generated_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) $(files_extra_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) $(files_extra_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) $(files_extra_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 ($(pangomm_generated_private_headers)) do @if 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_generated_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_generated_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\"
+       @copy ..\tools\m4\*.m4 
$(PREFIX)\share\pangomm-$(PANGOMM_MAJOR_VERSION).$(PANGOMM_MINOR_VERSION)\proc\m4
diff --git a/README.win32 b/README.win32
index f2203bd..4412c50 100644
--- a/README.win32
+++ b/README.win32
@@ -59,6 +59,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 2017 15.7.0 or later


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