mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 09:49:05 +00:00
Bundling update for macOS
This commit is contained in:
@@ -2,9 +2,8 @@
|
|||||||
# Zenmap, Ncat, and Ndiff.
|
# Zenmap, Ncat, and Ndiff.
|
||||||
|
|
||||||
export NMAP_VERSION := $(shell echo NMAP_VERSION | $(CPP) -imacros ../nmap.h - | sed -n '$$s/[" ]//g;$$p')
|
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_VERSION=$(shell sw_vers -productVersion | cut -d'.' -f1,2 | tr -d ' ')
|
||||||
OSX_VERSION=10.11
|
OSX_MIN_VERSION = 10.15
|
||||||
OSX_MIN_VERSION = 10.9
|
|
||||||
|
|
||||||
NAME_VERSION = nmap-$(NMAP_VERSION)$(if $(APPENDAGE),-$(APPENDAGE))
|
NAME_VERSION = nmap-$(NMAP_VERSION)$(if $(APPENDAGE),-$(APPENDAGE))
|
||||||
|
|
||||||
@@ -42,34 +41,11 @@ EXTRA_DIST = README.md ../LICENSE ../docs/3rd-party-licenses.txt ../docs/license
|
|||||||
|
|
||||||
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)"
|
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)"
|
||||||
|
|
||||||
# Flags for building universal binaries. See
|
CFLAGS = -mmacosx-version-min=$(OSX_MIN_VERSION)
|
||||||
# http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html.
|
CXXFLAGS = -mmacosx-version-min=$(OSX_MIN_VERSION)
|
||||||
UNIVERSAL_CONFIGURE_ARGS = --disable-dependency-tracking
|
|
||||||
UNIVERSAL_CC = gcc
|
|
||||||
UNIVERSAL_CXX = g++
|
|
||||||
# Setting ARCHFLAGS separately is required. distutils.util.get_platform
|
|
||||||
# sniffs it to determine whether to return a universal architecture
|
|
||||||
# ("fat" or "universal") or a single one ("i386" or "ppc"). py2app in
|
|
||||||
# turn uses the arch value to decide which of its bootstrappers to
|
|
||||||
# install.
|
|
||||||
UNIVERSAL_ARCHFLAGS = -arch x86_64
|
|
||||||
UNIVERSAL_CPPFLAGS = -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(OSX_VERSION).sdk
|
|
||||||
UNIVERSAL_CFLAGS = $(UNIVERSAL_CPPFLAGS) -mmacosx-version-min=$(OSX_MIN_VERSION) $(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/MacOSX$(OSX_VERSION).sdk -mmacosx-version-min=$(OSX_MIN_VERSION) $(UNIVERSAL_ARCHFLAGS)
|
|
||||||
|
|
||||||
CC = $(UNIVERSAL_CC)
|
|
||||||
CXX = $(UNIVERSAL_CXX)
|
|
||||||
ARCHFLAGS += $(UNIVERSAL_ARCHFLAGS)
|
|
||||||
CONFIGURE_ARGS += $(UNIVERSAL_CONFIGURE_ARGS)
|
|
||||||
CPPFLAGS += $(UNIVERSAL_CPPFLAGS)
|
|
||||||
CFLAGS += $(UNIVERSAL_CFLAGS)
|
|
||||||
CXXFLAGS += $(UNIVERSAL_CXXFLAGS)
|
|
||||||
LDFLAGS += $(UNIVERSAL_LDFLAGS)
|
|
||||||
|
|
||||||
# Jhbuild static libraries
|
# Jhbuild static libraries
|
||||||
PYTHON = $(JHBUILD_PREFIX)/bin/python2.7
|
PYTHON = $(JHBUILD_PREFIX)/bin/python3
|
||||||
OPENSSL_STATIC = $(JHBUILD_PREFIX)/lib/libssl.a $(JHBUILD_PREFIX)/lib/libcrypto.a
|
OPENSSL_STATIC = $(JHBUILD_PREFIX)/lib/libssl.a $(JHBUILD_PREFIX)/lib/libcrypto.a
|
||||||
LIBZ_STATIC = $(JHBUILD_PREFIX)/lib/libz.a
|
LIBZ_STATIC = $(JHBUILD_PREFIX)/lib/libz.a
|
||||||
|
|
||||||
@@ -135,7 +111,7 @@ $(IMAGE_STAGING_DIR)/$(PKG_NAME): check-nmap check-ncat check-ndiff check-zenmap
|
|||||||
mv $(NAME_VERSION).mpkg $(NAME_VERSION)/$(NAME_VERSION).mpkg
|
mv $(NAME_VERSION).mpkg $(NAME_VERSION)/$(NAME_VERSION).mpkg
|
||||||
|
|
||||||
check-%: stage-%
|
check-%: stage-%
|
||||||
if (find $*-root -perm -a+x -type f | xargs otool -L | grep -F "$(JHBUILD_PREFIX)"); then false; else echo "Libs are clean"; fi
|
(find $*-root -perm -a+x -type f | xargs otool -L | awk '/:$$/{e=$$0}index($$0,"$(JHBUILD_PREFIX)"){x=1;print e; print}END{exit x}') && echo "Libs are clean"
|
||||||
|
|
||||||
export-%:
|
export-%:
|
||||||
rm -rf $*
|
rm -rf $*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE moduleset SYSTEM "moduleset.dtd" [
|
<!DOCTYPE moduleset SYSTEM "moduleset.dtd" [
|
||||||
<!ENTITY nmap_version "7.92">
|
<!ENTITY nmap_version "7.93SVN">
|
||||||
|
<!ENTITY openssl_version "3.0.8">
|
||||||
]>
|
]>
|
||||||
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
|
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
|
||||||
<moduleset>
|
<moduleset>
|
||||||
@@ -17,14 +18,14 @@
|
|||||||
<!-- MODULES -->
|
<!-- MODULES -->
|
||||||
|
|
||||||
<!-- no-asm added to support building OpenSSL 3.0 on HighSierra. When upgrading to newer build system, remove it. -->
|
<!-- no-asm added to support building OpenSSL 3.0 on HighSierra. When upgrading to newer build system, remove it. -->
|
||||||
<autotools id="openssl" autogen-sh="Configure" autogenargs="shared no-asm enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers"
|
<autotools id="openssl" autogen-sh="Configure" autogenargs="shared enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers"
|
||||||
autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s
|
autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s
|
||||||
--openssldir=%(prefix)s/etc/ssl %(autogenargs)s"
|
--openssldir=%(prefix)s/etc/ssl %(autogenargs)s"
|
||||||
makeargs="depend all"
|
makeargs="depend all"
|
||||||
makeinstallargs="INSTALL_PREFIX='$(DESTDIR)' install_dev"
|
makeinstallargs="INSTALL_PREFIX='$(DESTDIR)' install_dev"
|
||||||
supports-parallel-builds="no"
|
supports-parallel-builds="no"
|
||||||
supports-non-srcdir-builds="no">
|
supports-non-srcdir-builds="no">
|
||||||
<branch repo="openssl" version="3.0.5" module="openssl-3.0.5.tar.gz"/>
|
<branch repo="openssl" version="&openssl_version;" module="openssl-&openssl_version;.tar.gz"/>
|
||||||
</autotools>
|
</autotools>
|
||||||
|
|
||||||
<autotools id="nmap" supports-non-srcdir-builds="no"
|
<autotools id="nmap" supports-non-srcdir-builds="no"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/bash -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
test "x$UNDER_JHBUILD" = "x" && exit 1
|
test "x$UNDER_JHBUILD" = "x" && exit 1
|
||||||
@@ -14,49 +14,69 @@ export ZENMAP_BUILD_DIR
|
|||||||
BASE=$ZENMAP_DIST_DIR/$APP_NAME.app/Contents
|
BASE=$ZENMAP_DIST_DIR/$APP_NAME.app/Contents
|
||||||
SCRIPT_DIR=`dirname "$0"`
|
SCRIPT_DIR=`dirname "$0"`
|
||||||
|
|
||||||
CC=${CC:-clang}
|
|
||||||
CFLAGS=${CFLAGS:--Wall -arch i386}
|
|
||||||
|
|
||||||
echo "Running $0."
|
echo "Running $0."
|
||||||
|
|
||||||
echo "Removing old build."
|
echo "Removing old build."
|
||||||
rm -rf "$ZENMAP_DIST_DIR" "$ZENMAP_BUILD_DIR"
|
rm -rf "$ZENMAP_DIST_DIR" "$ZENMAP_BUILD_DIR"
|
||||||
|
|
||||||
echo "Building bundle"
|
echo "Building python-launcher"
|
||||||
gtk-mac-bundler "$SCRIPT_DIR/zenmap.bundle"
|
$CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags --embed` \
|
||||||
|
-o $PREFIX/bin/zenmap-launcher \
|
||||||
|
~/gtk-mac-bundler/examples/python-launcher.c
|
||||||
|
|
||||||
|
echo "Generating dependencies"
|
||||||
|
# Have to run this with ~/gtk/inst/python3 or deps have wrong paths
|
||||||
|
python3 "$SCRIPT_DIR/../utils/get_deps.py" "$SCRIPT_DIR/pyreqs.xml"
|
||||||
|
# gtk-mac-bundler (xml.dom.minidom) doesn't expand external entities
|
||||||
|
xmllint --format --noent "$SCRIPT_DIR/zenmap.bundle" > "$SCRIPT_DIR/tmp.bundle"
|
||||||
|
|
||||||
|
echo "Building bundle"
|
||||||
|
gtk-mac-bundler "$SCRIPT_DIR/tmp.bundle"
|
||||||
|
|
||||||
|
echo "Removing unneeded items"
|
||||||
|
# GIR files not needed, only typelib
|
||||||
|
rm -rf $BASE/Resources/share/gir-1.0/
|
||||||
|
|
||||||
|
echo "Creating caches"
|
||||||
|
pushd "$BASE/Resources"
|
||||||
|
export GDK_PIXBUF_MODULEDIR=$(ls - lib/gdk-pixbuf-2.0/2.*/loaders)
|
||||||
|
gdk-pixbuf-query-loaders > "$GDK_PIXBUF_MODULEDIR".cache
|
||||||
|
gtk-update-icon-cache share/icons/hicolor
|
||||||
|
popd
|
||||||
|
|
||||||
|
# echo "Compiling Python to bytecode"
|
||||||
|
PYTHONLIB=$(ls -d $BASE/Resources/lib/python3.*)
|
||||||
|
# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
|
||||||
|
# See PEP-3147
|
||||||
|
find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
|
||||||
|
python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB"
|
||||||
|
|
||||||
|
# Remove source if compiled is available, except for Zenmap itself:
|
||||||
|
find "$PYTHONLIB" \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
|
||||||
|
rm -f "${pyc%.pyc}.py"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Now compile Zenmap using default (not legacy) location.
|
||||||
|
# If we had used legacy location, python.exe tries to write out the PEP-3147
|
||||||
|
# location anyway when source is available.
|
||||||
|
python -m compileall "$PYTHONLIB"/site-packages #|| true
|
||||||
echo "Stripping unoptimized Python libraries"
|
echo "Stripping unoptimized Python libraries"
|
||||||
#Remove some stuff that is unneeded. This cuts 40M off the installed size.
|
|
||||||
rm -rf $BASE/Resources/lib/python2.7/test/
|
|
||||||
rm -rf $BASE/Resources/lib/python2.7/config/
|
|
||||||
rm -rf $BASE/Resources/lib/python2.7/idlelib/
|
|
||||||
rm -rf $BASE/Resources/lib/python2.7/lib-tk/
|
|
||||||
rm -rf $BASE/Resources/lib/python2.7/lib2to3/
|
|
||||||
rm -f $BASE/Resources/lib/python2.7/site-packages/*.a
|
|
||||||
find "$BASE/Resources/lib/python2.7" -type f -name '*.py' | while read py; do
|
|
||||||
# If the .pyc exists, delete the .py
|
|
||||||
test -f "${py}c" && rm -v "$py"
|
|
||||||
done
|
|
||||||
find "$BASE/Resources/lib/python2.7" -type f -name '*.pyo' | while read py; do
|
|
||||||
# If the .pyc exists, delete the .pyo
|
|
||||||
test -f "${py/%o/c}" && rm -v "$py"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Building using distutils"
|
echo "Building using distutils"
|
||||||
python setup.py build --executable "/usr/bin/env python"
|
$PYTHON setup.py build --executable "/usr/bin/env python3"
|
||||||
python setup.py install vanilla --prefix "$BASE/Resources"
|
$PYTHON setup.py install vanilla --prefix "$BASE/Resources"
|
||||||
|
|
||||||
echo "Renaming main Zenmap executable."
|
echo "Renaming main Zenmap executable."
|
||||||
mv $BASE/MacOS/$APP_NAME $BASE/MacOS/zenmap.bin
|
mv $BASE/MacOS/$APP_NAME $BASE/MacOS/zenmap.bin
|
||||||
# This is a dummy script, so we'll clean it up:
|
# This is a dummy script, so we'll clean it up:
|
||||||
rm $BASE/MacOS/$APP_NAME-bin
|
#rm $BASE/MacOS/$APP_NAME-bin
|
||||||
|
|
||||||
echo "Compiling and installing authorization wrapper."
|
echo "Compiling and installing authorization wrapper."
|
||||||
echo $CC $CPPFLAGS $CFLAGS $LDFLAGS -v "$SCRIPT_DIR/zenmap_auth.m" -lobjc -framework Foundation -o "$BASE/MacOS/$APP_NAME"
|
echo $CC $CPPFLAGS $OBJCFLAGS $LDFLAGS -v "$SCRIPT_DIR/zenmap_auth.m" -lobjc -framework Foundation -o "$BASE/MacOS/$APP_NAME"
|
||||||
$CC $CPPFLAGS $CFLAGS $LDFLAGS -v "$SCRIPT_DIR/zenmap_auth.m" -lobjc -framework Foundation -o "$BASE/MacOS/$APP_NAME"
|
$CC $CPPFLAGS $OBJCFLAGS $LDFLAGS -v "$SCRIPT_DIR/zenmap_auth.m" -lobjc -framework Foundation -o "$BASE/MacOS/$APP_NAME"
|
||||||
|
|
||||||
echo "Filling out Info.plist"
|
echo "Filling out Info.plist"
|
||||||
python - "$SCRIPT_DIR/Info.plist" >"$BASE/Info.plist" <<'EOF'
|
$PYTHON - "$SCRIPT_DIR/Info.plist" >"$BASE/Info.plist" <<'EOF'
|
||||||
import sys
|
import sys
|
||||||
from string import Template
|
from string import Template
|
||||||
from zenmapCore.Version import *
|
from zenmapCore.Version import *
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||||
|
<!DOCTYPE app-bundle [
|
||||||
|
<!ENTITY PYVER "3.10">
|
||||||
|
<!ENTITY pyreqs SYSTEM "pyreqs.xml">
|
||||||
|
]>
|
||||||
<app-bundle>
|
<app-bundle>
|
||||||
|
|
||||||
<meta>
|
<meta>
|
||||||
@@ -23,14 +27,14 @@
|
|||||||
<!-- Comment this out to keep the install names in binaries. -->
|
<!-- Comment this out to keep the install names in binaries. -->
|
||||||
<run-install-name-tool/>
|
<run-install-name-tool/>
|
||||||
|
|
||||||
<!--A launcher script is pretty much mandatory here so that we can
|
<!-- REMOVED: A launcher script is pretty much mandatory here so that we can
|
||||||
set $PYTHON to point to the python in the bundle.
|
set $PYTHON to point to the python in the bundle.
|
||||||
-->
|
|
||||||
<launcher-script>${project}/launcher.sh</launcher-script>
|
<launcher-script>${project}/launcher.sh</launcher-script>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- Indicate the active gtk version to use. This is needed only
|
<!-- Indicate the active gtk version to use. This is needed only
|
||||||
for gtk+-3.0 projects. -->
|
for gtk+-3.0 projects. -->
|
||||||
<!--gtk>gtk+-2.0</gtk-->
|
<gtk>gtk+-3.0</gtk>
|
||||||
</meta>
|
</meta>
|
||||||
|
|
||||||
<!-- The special macro "${project}" refers to the directory where
|
<!-- The special macro "${project}" refers to the directory where
|
||||||
@@ -39,92 +43,83 @@
|
|||||||
-->
|
-->
|
||||||
<plist>${project}/Info.plist</plist>
|
<plist>${project}/Info.plist</plist>
|
||||||
|
|
||||||
<!-- This is mandatory, and the result gets named to the appname from
|
<!-- See examples/python-launcher.bundle for info on entitlements if needed -->
|
||||||
Info.plist with bin tacked on the end, in this example,
|
<!-- NEW! -->
|
||||||
PyGtkDemo-bin. Bundler won't let us use the one from $project,
|
<!-- Build gramps-launcher with:
|
||||||
so we use the original and ignore it. If your original will work
|
gcc -L$PREFIX/lib `python-config -\-cflags -\-ldflags` \
|
||||||
in the bundle, you can use this instead.-->
|
-o $PREFIX/bin/python-launcher \
|
||||||
|
path/to/gtk-mac-bundler/examples/python-launcher.c
|
||||||
|
with the obvious substitution.
|
||||||
|
-->
|
||||||
<main-binary>
|
<main-binary>
|
||||||
${prefix}/bin/pygtk-demo
|
${prefix}/bin/zenmap-launcher
|
||||||
</main-binary>
|
</main-binary>
|
||||||
|
|
||||||
<!-- We need to pack our own Python to avoid compatibility problems. -->
|
<!-- We need to pack our own Python to avoid compatibility problems. -->
|
||||||
<binary dest="${bundle}/Contents/MacOS">
|
<binary dest="${bundle}/Contents/MacOS">
|
||||||
${prefix}/bin/python
|
${prefix}/bin/python3
|
||||||
</binary>
|
</binary>
|
||||||
|
<!-- Copy in GTK+ modules. Note the use of the
|
||||||
<!-- Copy in libpyglib, which will pull in other dependencies we need -->
|
|
||||||
<binary>
|
|
||||||
${prefix}/lib/libpyglib-2.0-python2.0.dylib
|
|
||||||
</binary>
|
|
||||||
<!-- Gtk+ is required by python modules which aren't searched for
|
|
||||||
dependencies, so we have to pull it in explicitly. It will
|
|
||||||
bring Pango and Cairo with it. Note the use of ${gtkversion},
|
|
||||||
which expands to either 2.0 or 3.0, depending on which value of
|
|
||||||
gtk is specified.-->
|
|
||||||
<binary>
|
|
||||||
${prefix}/lib/libgtk-quartz-${gtkversion}.0.dylib
|
|
||||||
</binary>
|
|
||||||
|
|
||||||
<!-- Copy in GTK+ modules. Note the ${gtkdir} macro, which expands
|
|
||||||
to the correct library subdirectory for the specified gtk
|
|
||||||
version.
|
|
||||||
-->
|
|
||||||
<binary>
|
|
||||||
${prefix}/lib/${gtkdir}/modules/*.so
|
|
||||||
</binary>
|
|
||||||
|
|
||||||
<!-- Copy in GTK+ theme engines and print backends. Note the use of the
|
|
||||||
"${pkg:module:variable}" macro, which evaluates to a pkg-config
|
"${pkg:module:variable}" macro, which evaluates to a pkg-config
|
||||||
variable in the specified module. Note that any libraries that
|
variable in the specified module. Note that any libraries that
|
||||||
binaries link to are also copied in automatically. Note also
|
binaries link to are also copied in automatically.
|
||||||
the included ${gtk} macro, which gets the correct package name
|
-->
|
||||||
to get. -->
|
<!-- PNG is built-in -->
|
||||||
<binary>
|
<binary>
|
||||||
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/*.so
|
${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/libpixbufloader-gif.so
|
||||||
</binary>
|
</binary>
|
||||||
|
|
||||||
|
<!-- Copy in the quartz input method. The rest aren't used on MacOS. -->
|
||||||
|
<binary>
|
||||||
|
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/im-quartz.so
|
||||||
|
</binary>
|
||||||
|
|
||||||
|
<!-- And the print backends -->
|
||||||
<binary>
|
<binary>
|
||||||
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
|
${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
|
||||||
</binary>
|
</binary>
|
||||||
|
|
||||||
<!-- Starting with 2.24, gdk-pixbuf installs into its own directory. -->
|
<!-- Python modules other than tnese are grabbed with get_deps.py -->
|
||||||
<binary>
|
<binary>
|
||||||
${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/loaders/*.so
|
${prefix}/lib/python&PYVER;/site-packages/gi/*.so
|
||||||
|
</binary>
|
||||||
|
<binary>
|
||||||
|
${prefix}/lib/python&PYVER;/site-packages/cairo/*.so
|
||||||
</binary>
|
</binary>
|
||||||
|
|
||||||
<!-- Translation filenames, one for each program or library that you
|
&pyreqs;
|
||||||
want to copy in to the bundle. The "dest" attribute is
|
|
||||||
optional, as usual. Bundler will find all translations of that
|
|
||||||
library/program under the indicated directory and copy them.-->
|
|
||||||
<translations name="gtk20">
|
|
||||||
${prefix}/share/locale
|
|
||||||
</translations>
|
|
||||||
|
|
||||||
|
<binary>
|
||||||
|
${prefix}/lib/libgtkmacintegration-gtk3.dylib
|
||||||
|
</binary>
|
||||||
|
|
||||||
<!-- We have to pull in the python modules, which are mixed python
|
<gir> ${prefix}/share/gir-1.0/Atk-1.0.gir </gir>
|
||||||
and loadable modules. -->
|
<gir> ${prefix}/share/gir-1.0/GLib-2.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/lib-dynload/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/GModule-2.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/GObject-2.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/cairo/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/Gdk-3.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/glib/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/GdkPixbuf-2.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/gobject/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/Gio-2.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/gtk-2.0/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/Gtk-3.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/gtk-2.0/gio/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/HarfBuzz-0.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/gtk-2.0/gtk/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/Pango-1.0.gir </gir>
|
||||||
<binary>${prefix}/lib/python2.7/site-packages/gtkosx_application/*.so</binary>
|
<gir> ${prefix}/share/gir-1.0/PangoCairo-1.0.gir </gir>
|
||||||
<!-- Pending this pull request: https://github.com/GNOME/gtk-mac-bundler/pull/1
|
<gir> ${prefix}/share/gir-1.0/PangoOT-1.0.gir </gir>
|
||||||
Without it, this data block will overwrite the binaries above, undoing
|
<gir> ${prefix}/share/gir-1.0/cairo-1.0.gir </gir>
|
||||||
the work of the run-install-name-tool option. -->
|
<gir> ${prefix}/share/gir-1.0/freetype2-2.0.gir </gir>
|
||||||
<data>
|
|
||||||
${prefix}/lib/python2.7/
|
<!-- This python file sets up all of the environment variables
|
||||||
|
needed to run your program. The example contains those
|
||||||
|
necessary for running a basic Gtk program. -->
|
||||||
|
<data dest="${bundle}/Contents/Resources">
|
||||||
|
${project}/zenmap_launcher.py
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<!-- Copy in the themes data. You may want to trim this to save space
|
|
||||||
in your bundle. -->
|
|
||||||
<data>
|
<data>
|
||||||
${prefix}/share/themes
|
${prefix}/share/glib-2.0/schemas
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
|
||||||
<!-- Copy icons. Note that the .icns file is an Apple format which
|
<!-- Copy icons. Note that the .icns file is an Apple format which
|
||||||
contains up to 4 sizes of icon. You can use
|
contains up to 4 sizes of icon. You can use
|
||||||
/Developer/Applications/Utilities/Icon Composer.app to import
|
/Developer/Applications/Utilities/Icon Composer.app to import
|
||||||
@@ -133,14 +128,6 @@
|
|||||||
${project}/zenmap.icns
|
${project}/zenmap.icns
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<!-- This is where theme commands go. You can copy them in from your
|
|
||||||
theme of choice if they provide and example, or you can just
|
|
||||||
change the source path. -->
|
|
||||||
|
|
||||||
<data dest="${bundle}/Contents/Resources/etc/${gtkdir}/gtkrc">
|
|
||||||
${project}/gtkrc
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<!-- Icon themes to copy. The "icons" property can be either of
|
<!-- Icon themes to copy. The "icons" property can be either of
|
||||||
"auto", "all", or "none". All or none should be
|
"auto", "all", or "none". All or none should be
|
||||||
self-explanatory, while auto means that the script will try to
|
self-explanatory, while auto means that the script will try to
|
||||||
@@ -150,7 +137,7 @@
|
|||||||
if you want just the index.theme file but no icons, mostly
|
if you want just the index.theme file but no icons, mostly
|
||||||
needed for the "hicolor" base theme.
|
needed for the "hicolor" base theme.
|
||||||
>
|
>
|
||||||
<icon-theme icons="auto">
|
<icon-theme icons="none">
|
||||||
Tango
|
Tango
|
||||||
</icon-theme -->
|
</icon-theme -->
|
||||||
|
|
||||||
|
|||||||
43
zenmap/install_scripts/macosx/zenmap_launcher.py
Normal file
43
zenmap/install_scripts/macosx/zenmap_launcher.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
from os.path import join, dirname, abspath, normpath
|
||||||
|
import sys, os
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
|
bundlepath = sys.argv[0]
|
||||||
|
|
||||||
|
bundle_contents = join(bundlepath, 'Contents')
|
||||||
|
bundle_res = join(bundle_contents, 'Resources')
|
||||||
|
|
||||||
|
bundle_lib = join(bundle_res, 'lib')
|
||||||
|
bundle_bin = join(bundle_res, 'bin')
|
||||||
|
bundle_data = join(bundle_res, 'share')
|
||||||
|
bundle_etc = join(bundle_res, 'etc')
|
||||||
|
|
||||||
|
os.environ['XDG_DATA_DIRS'] = bundle_data
|
||||||
|
os.environ['DYLD_LIBRARY_PATH'] = bundle_lib
|
||||||
|
os.environ['LD_LIBRARY_PATH'] = bundle_lib
|
||||||
|
os.environ['GTK_DATA_PREFIX'] = bundle_res
|
||||||
|
os.environ['GTK_EXE_PREFIX'] = bundle_res
|
||||||
|
os.environ['GTK_PATH'] = bundle_res
|
||||||
|
|
||||||
|
os.environ['PANGO_RC_FILE'] = join(bundle_etc, 'pango', 'pangorc')
|
||||||
|
os.environ['PANGO_SYSCONFDIR'] = bundle_etc
|
||||||
|
os.environ['PANGO_LIBDIR'] = bundle_lib
|
||||||
|
os.environ['GDK_PIXBUF_MODULE_FILE'] = join(bundle_lib, 'gdk-pixbuf-2.0',
|
||||||
|
'2.10.0', 'loaders.cache')
|
||||||
|
if int(platform.release().split('.')[0]) > 10:
|
||||||
|
os.environ['GTK_IM_MODULE_FILE'] = join(bundle_etc, 'gtk-3.0',
|
||||||
|
'gtk.immodules')
|
||||||
|
|
||||||
|
os.environ['GI_TYPELIB_PATH'] = join(bundle_lib, 'girepository-1.0')
|
||||||
|
|
||||||
|
#Set $PYTHON to point inside the bundle
|
||||||
|
PYVER = 'python3.10'
|
||||||
|
sys.path.append(bundle_res)
|
||||||
|
|
||||||
|
os.environ['USERPROFILE'] = os.environ['HOME']
|
||||||
|
os.environ['APPDATA'] = join(os.environ['HOME'], 'Library', 'Application Support')
|
||||||
|
# Replace my_app with the file or module with your main() function.
|
||||||
|
from zenmapGUI import App
|
||||||
|
App.run()
|
||||||
|
|
||||||
@@ -7,16 +7,16 @@ import os.path
|
|||||||
import site
|
import site
|
||||||
import encodings
|
import encodings
|
||||||
|
|
||||||
site_package_deps = ("zenmapCore", "zenmapGUI", "radialnet", "gi", "cairo")
|
site_package_deps = ("gi", "cairo")
|
||||||
|
|
||||||
# These items are unneeded, large, and on macOS _ssl causes dependency problems.
|
# These items are unneeded, large, and on macOS _ssl causes dependency problems.
|
||||||
pyd_remove = ("_decimal", "_ssl", "_testcapi")
|
pyd_remove = ("_decimal", "_ssl", "_testcapi", "_hashlib")
|
||||||
|
|
||||||
def module_paths(mods):
|
def module_paths(mods):
|
||||||
for m in mods:
|
for m in mods:
|
||||||
if m.__name__ in pyd_remove:
|
if m.__name__ in pyd_remove:
|
||||||
continue
|
continue
|
||||||
elif getattr(m, "__file__", None) and ('..' not in m.__file__):
|
elif getattr(m, "__file__", None) and not m.__file__.endswith("zenmap"):
|
||||||
yield m.__file__
|
yield m.__file__
|
||||||
|
|
||||||
def get_deps():
|
def get_deps():
|
||||||
@@ -31,12 +31,12 @@ def get_deps():
|
|||||||
|
|
||||||
# Now use modulefinder to get the rest
|
# Now use modulefinder to get the rest
|
||||||
mfind = modulefinder.ModuleFinder()
|
mfind = modulefinder.ModuleFinder()
|
||||||
mfind.run_script('../../zenmap')
|
mfind.run_script(os.path.normpath(__file__ + '/../../../zenmap'))
|
||||||
for path in module_paths(mfind.modules.values()):
|
for path in module_paths(mfind.modules.values()):
|
||||||
parent = os.path.dirname(path)
|
parent = os.path.dirname(path)
|
||||||
found_parent = False
|
found_parent = False
|
||||||
# If a parent dir is already included, don't bother listing the file.
|
# If a parent dir is already included, don't bother listing the file.
|
||||||
while parent not in sys.path:
|
while parent not in sys.path and len(parent) > 2:
|
||||||
if parent in files:
|
if parent in files:
|
||||||
found_parent = True
|
found_parent = True
|
||||||
break
|
break
|
||||||
@@ -59,6 +59,14 @@ def update_cfg(cfg, files):
|
|||||||
oldvalue = cfg.get('bundle', 'nodelete')
|
oldvalue = cfg.get('bundle', 'nodelete')
|
||||||
cfg.set('bundle', 'nodelete', oldvalue + "\nmingw*" + filestr)
|
cfg.set('bundle', 'nodelete', oldvalue + "\nmingw*" + filestr)
|
||||||
|
|
||||||
|
def write_xml(filename, files):
|
||||||
|
with open(filename, "w") as f:
|
||||||
|
for file in files:
|
||||||
|
fname = r"${prefix}" + file.removeprefix(sys.prefix)
|
||||||
|
fmt = "<data>{}</data>"
|
||||||
|
if file.endswith(".so"):
|
||||||
|
fmt = "<binary>{}</binary>"
|
||||||
|
print(fmt.format(fname), file=f)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
files = get_deps()
|
files = get_deps()
|
||||||
@@ -66,6 +74,7 @@ if __name__ == "__main__":
|
|||||||
cfg = read_cfg(sys.argv[2])
|
cfg = read_cfg(sys.argv[2])
|
||||||
update_cfg(cfg, files)
|
update_cfg(cfg, files)
|
||||||
write_cfg(cfg, sys.argv[1])
|
write_cfg(cfg, sys.argv[1])
|
||||||
#elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
|
write_xml(sys.argv[1], files)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|||||||
@@ -145,15 +145,15 @@ nodelete =
|
|||||||
# Zenmap's files (mostly in site-packages above)
|
# Zenmap's files (mostly in site-packages above)
|
||||||
mingw*/share/zenmap
|
mingw*/share/zenmap
|
||||||
# mingw*/bin/zenmap
|
# mingw*/bin/zenmap
|
||||||
|
mingw*/lib/python3.*/site-packages/zenmapCore
|
||||||
|
mingw*/lib/python3.*/site-packages/zenmapGUI
|
||||||
|
mingw*/lib/python3.*/site-packages/radialnet
|
||||||
|
|
||||||
# The python modules here will be added by script:
|
# The python modules here will be added by script:
|
||||||
# mingw*/lib/python3.*
|
# mingw*/lib/python3.*
|
||||||
# mingw*/lib/python3.*/encodings
|
# mingw*/lib/python3.*/encodings
|
||||||
# mingw*/lib/python3.*/site.py
|
# mingw*/lib/python3.*/site.py
|
||||||
# mingw*/lib/python3.*/_sitebuiltins.py
|
# mingw*/lib/python3.*/_sitebuiltins.py
|
||||||
# mingw*/lib/python3.*/site-packages/zenmapCore
|
|
||||||
# mingw*/lib/python3.*/site-packages/zenmapGUI
|
|
||||||
# mingw*/lib/python3.*/site-packages/radialnet
|
|
||||||
# mingw*/lib/python3.*/site-packages/gi
|
# mingw*/lib/python3.*/site-packages/gi
|
||||||
# mingw*/lib/python3.*/site-packages/cairo
|
# mingw*/lib/python3.*/site-packages/cairo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user