From 1da018a45496c2a6cc79f5b965f2075cfc2a7124 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 5 Jun 2016 15:32:17 +0000 Subject: [PATCH] Makefile portability changes and packagemaker replacement --- macosx/Makefile | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/macosx/Makefile b/macosx/Makefile index b5452254b..9906e7d4b 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -3,6 +3,7 @@ NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') +OSX_VERSION=$(shell sw_vers -productVersion | cut -d'.' -f1,2 | tr -d ' ') NAME_VERSION = nmap-$(NMAP_VERSION)$(if $(APPENDAGE),-$(APPENDAGE)) @@ -53,11 +54,11 @@ UNIVERSAL_CXX = g++ # turn uses the arch value to decide which of its bootstrappers to # install. UNIVERSAL_ARCHFLAGS = -arch i386 -UNIVERSAL_CPPFLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk +UNIVERSAL_CPPFLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(OSX_VERSION).sdk UNIVERSAL_CFLAGS = $(UNIVERSAL_CPPFLAGS) -mmacosx-version-min=10.8 $(UNIVERSAL_ARCHFLAGS) UNIVERSAL_CXXFLAGS = $(UNIVERSAL_CFLAGS) # https://stackoverflow.com/questions/19637164/c-linking-error-after-upgrading-to-mac-os-x-10-9-xcode-5-0-1/19637199#19637199 -UNIVERSAL_LDFLAGS = -stdlib=libstdc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 $(UNIVERSAL_ARCHFLAGS) +UNIVERSAL_LDFLAGS = -stdlib=libstdc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(OSX_VERSION).sdk -mmacosx-version-min=10.8 $(UNIVERSAL_ARCHFLAGS) CC = $(UNIVERSAL_CC) CXX = $(UNIVERSAL_CXX) @@ -86,7 +87,34 @@ have-%: $(IMAGE_STAGING_DIR)/$(PKG_NAME): check-nmap check-ncat check-ndiff check-zenmap check-nping check-nmap-update COPYING.formatted mkdir -p $(IMAGE_STAGING_DIR) cp -rf $(EXTRA_DIST) $(IMAGE_STAGING_DIR)/ - $(PACKAGEMAKER) --doc nmap.pmdoc --title "Nmap $(NMAP_VERSION)" --no-relocate -o $@ + # create packages + pkgbuild --root $(NCAT_STAGING_DIR) --identifier org.insecure.nmap.ncat --version $(NMAP_VERSION) --install-location / ncat.pkg + pkgbuild --root $(NDIFF_STAGING_DIR) --identifier org.insecure.nmap.ndiff --version $(NMAP_VERSION) --install-location / ndiff.pkg + pkgbuild --root $(NMAP_STAGING_DIR) --identifier org.insecure.nmap --version $(NMAP_VERSION) --install-location / nmap.pkg + pkgbuild --root $(NPING_STAGING_DIR) --identifier org.insecure.nmap.nping --version $(NMAP_VERSION) --install-location / nping.pkg + pkgbuild --root $(NMAP_UPDATE_STAGING_DIR) --identifier org.insecure.nmap.nmap-update --version $(NMAP_VERSION) --install-location / nmap-update.pkg + pkgbuild --root $(ZENMAP_STAGING_DIR) --identifier org.insecure.nmap.zenmap --version $(NMAP_VERSION) --install-location /Applications zenmap.pkg + + # produce a .xml with packages informations + productbuild --synthesize \ + --package 'ncat.pkg' \ + --package 'ndiff.pkg' \ + --package 'nmap.pkg' \ + --package 'nping.pkg' \ + --package 'nmap-update.pkg' \ + --package 'zenmap.pkg' \ + distribution.xml + + # make a new file and add background and titles attributes + head -n 2 distribution.xml > finalDist.xml + echo " Nmap $(NMAP_VERSION)" >> finalDist.xml + tail -n +3 distribution.xml >> finalDist.xml + + # build the .mpkg according to the final .xml file + productbuild --distribution finalDist.xml --resources . --package-path . $(NAME_VERSION).mpkg + + mv $(NAME_VERSION).mpkg $(NAME_VERSION)/$(NAME_VERSION).mpkg + rm -rf distribution.xml finalDist.xml ncat.pkg ndiff.pkg nmap.pkg nping.pkg nmap-update.pkg zenmap.pkg check-%: stage-% if (find $* -perm -a+x -type f | xargs otool -L | grep -F "$(JHBUILD_PREFIX)"); then false; else echo "Libs are clean"; fi