# This makefile builds a disk image (.dmg) containing the installer for Nmap, # Zenmap, Ncat, and Ndiff. export NMAP_VERSION := $(shell echo NMAP_VERSION | $(CPP) -imacros ../nmap.h - | sed -n '$$s/[" ]//g;$$p') OSX_VERSION=$(shell sw_vers -productVersion | cut -d'.' -f1,2 | tr -d ' ') OSX_MIN_VERSION = 10.15 NAME_VERSION = nmap-$(NMAP_VERSION)$(if $(APPENDAGE),-$(APPENDAGE)) IMAGE_NAME = $(NAME_VERSION).dmg PKG_NAME = $(NAME_VERSION).mpkg IMAGE_STAGING_DIR = $(NAME_VERSION) NMAP_BUILD_DIR = nmap-build NMAP_STAGING_DIR = nmap-root ZENMAP_BUILD_DIR = zenmap-build ZENMAP_STAGING_DIR = zenmap-root NCAT_BUILD_DIR = ncat-build NCAT_STAGING_DIR = ncat-root NDIFF_BUILD_DIR = ndiff-build NDIFF_STAGING_DIR = ndiff-root NPING_BUILD_DIR = nping-build NPING_STAGING_DIR = nping-root JHBUILD_PREFIX=$(HOME)/gtk/inst JHBUILD_SOURCE=$(HOME)/gtk/source PREFIX = /usr/local # Extra distribution file names README_FILE = README.md LICENSE_FILE = LICENSE 3RD_P_LIC_FILE = 3rd-party-licenses.txt LICENSES_FILE = licenses EXTRA_DIST = README.md ../LICENSE ../docs/3rd-party-licenses.txt ../docs/licenses CONFIGURE_ARGS = --prefix="$(PREFIX)" --with-libdnet=included --with-libpcap=included --with-libpcre=included --with-liblua=included CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" PYTHON="$(PYTHON)" CFLAGS = -mmacosx-version-min=$(OSX_MIN_VERSION) CXXFLAGS = -mmacosx-version-min=$(OSX_MIN_VERSION) # Jhbuild static libraries PYTHON = $(JHBUILD_PREFIX)/bin/python3 OPENSSL_STATIC = $(JHBUILD_PREFIX)/lib/libssl.a $(JHBUILD_PREFIX)/lib/libcrypto.a LIBZ_STATIC = $(JHBUILD_PREFIX)/lib/libz.a # These are the positions used by the createdmg.sh and check_test.sh scripts export ICON_SIZE=88 export FONT_SIZE=13 export MPKG_POS_X=110 export MPKG_POS_Y=170 export APPS_POS_X=110 export APPS_POS_Y=310 export README_POS_X=802 export README_POS_Y=180 export LICENSE_POS_X=802 export LICENSE_POS_Y=310 export THIRD_P_POS_X=802 export THIRD_P_POS_Y=440 export LICENSES_POS_X=670 export LICENSES_POS_Y=60 $(IMAGE_NAME): tool-checks $(IMAGE_STAGING_DIR)/$(PKG_NAME) rm -f $@ # Create the dmg disk image and convert it to read only disk ./createdmg.sh $(IMAGE_STAGING_DIR) $(README_FILE) $(LICENSE_FILE) $(3RD_P_LIC_FILE) $(LICENSES_FILE) # Check the created disk image for the sizes, backgrounds and icons presence and positions ./check_test.sh $(README_FILE) $(LICENSE_FILE) $(3RD_P_LIC_FILE) $(LICENSES_FILE) tool-checks: have-jhbuild have-gtk-mac-bundler have-%: which $* #$(IMAGE_STAGING_DIR)/$(PKG_NAME): check-nmap check-ncat check-ndiff check-zenmap check-nping LICENSE.formatted $(IMAGE_STAGING_DIR)/$(PKG_NAME): check-nmap check-ncat check-ndiff check-zenmap check-nping LICENSE.formatted rm -rf $(IMAGE_STAGING_DIR) mkdir -p $(IMAGE_STAGING_DIR) cp -rf $(EXTRA_DIST) $(IMAGE_STAGING_DIR)/ # Create packages (.pkg) for all the components to install in the installer (.mpkg) pkgbuild --root $(NMAP_STAGING_DIR) --identifier org.insecure.nmap --version $(NMAP_VERSION) --install-location /usr/local nmap.pkg pkgbuild --root $(NCAT_STAGING_DIR) --identifier org.insecure.nmap.ncat --version $(NMAP_VERSION) --install-location /usr/local ncat.pkg pkgbuild --root $(NDIFF_STAGING_DIR)/usr/local --identifier org.insecure.nmap.ndiff --version $(NMAP_VERSION) --install-location /usr/local ndiff.pkg pkgbuild --root $(NPING_STAGING_DIR) --identifier org.insecure.nmap.nping --version $(NMAP_VERSION) --install-location /usr/local nping.pkg pkgbuild --root $(ZENMAP_STAGING_DIR) --identifier org.insecure.nmap.zenmap --version $(NMAP_VERSION) --install-location /Applications zenmap.pkg # Produce a .xml with packages information productbuild --synthesize \ --package 'nmap.pkg' \ --package 'ncat.pkg' \ --package 'ndiff.pkg' \ --package 'nping.pkg' \ --package 'zenmap.pkg' \ distribution.xml # Make a new file and add background and title attributes head -n 2 distribution.xml > finalDist.xml echo "