mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 05:31:31 +00:00
Fixes for Windows Zenmap build
This commit is contained in:
@@ -5,6 +5,7 @@ import configparser
|
|||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import site
|
import site
|
||||||
|
import _sitebuiltins
|
||||||
import encodings
|
import encodings
|
||||||
|
|
||||||
site_package_deps = ("gi", "cairo")
|
site_package_deps = ("gi", "cairo")
|
||||||
@@ -26,7 +27,7 @@ def get_deps():
|
|||||||
|
|
||||||
# These items are missed by modulefinder
|
# These items are missed by modulefinder
|
||||||
files.add(encodings.__path__[0]) # All encodings just in case
|
files.add(encodings.__path__[0]) # All encodings just in case
|
||||||
for path in module_paths((site, site._sitebuiltins)):
|
for path in module_paths((site, _sitebuiltins)):
|
||||||
files.add(path)
|
files.add(path)
|
||||||
|
|
||||||
# Now use modulefinder to get the rest
|
# Now use modulefinder to get the rest
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
export MSYS2_ARG_CONV_EXCL=""
|
export MSYS2_ARG_CONV_EXCL=""
|
||||||
all: dist/zenmap-w64-deletelog.txt mingw-w64-x86_64-python-zenmap-*.pkg.tar.zst
|
MINGW_PREFIX=mingw-w64-x86_64
|
||||||
|
all: dist/zenmap-w64-deletelog.txt $(MINGW_PREFIX)-python-zenmap-*.pkg.tar.zst
|
||||||
./build.sh
|
./build.sh
|
||||||
|
|
||||||
mingw-w64-x86_64-python-zenmap-%.pkg.tar.zst: PKGBUILD
|
$(MINGW_PREFIX)-python-zenmap-%.pkg.tar.zst: PKGBUILD
|
||||||
makepkg-mingw -RdfL
|
#pacman -Sy
|
||||||
|
pacman -R --noconfirm $(MINGW_PREFIX)-python-zenmap || true
|
||||||
|
makepkg-mingw -sfLi --noconfirm
|
||||||
|
|
||||||
dist/zenmap-w64-deletelog.txt: tmp.cfg mingw-w64-x86_64-python-zenmap-*.pkg.tar.zst
|
dist/zenmap-w64-deletelog.txt: tmp.cfg mingw-w64-x86_64-python-zenmap-*.pkg.tar.zst
|
||||||
styrene -p . -o $(dir $@) tmp.cfg --no-exe --no-zip
|
styrene -p . -o $(dir $@) tmp.cfg --no-exe --no-zip
|
||||||
|
|
||||||
tmp.cfg: styrene.cfg ../utils/get_deps.py
|
tmp.cfg: styrene.cfg ../utils/get_deps.py $(MINGW_PREFIX)-python-zenmap-*.pkg.tar.zst
|
||||||
python3 ../utils/get_deps.py $@ $<
|
python3 ../utils/get_deps.py $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -17,15 +17,26 @@ pkgdesc="Graphical Nmap frontend and results viewer"
|
|||||||
url="https://nmap.org/zenmap/"
|
url="https://nmap.org/zenmap/"
|
||||||
arch=("any")
|
arch=("any")
|
||||||
license=("NPSL")
|
license=("NPSL")
|
||||||
source=("https://nmap.org/dist/nmap-${pkgver}.tar.bz2")
|
#source=("https://nmap.org/dist/nmap-${pkgver}.tar.bz2")
|
||||||
sha256sums=("SKIP")
|
#sha256sums=("SKIP")
|
||||||
mingw_arch=('mingw64')
|
mingw_arch=('mingw64')
|
||||||
depends=("${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-python-gobject")
|
depends=("${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-python-gobject")
|
||||||
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
|
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
|
||||||
|
"${MINGW_PACKAGE_PREFIX}-python-installer"
|
||||||
|
"${MINGW_PACKAGE_PREFIX}-python-setuptools"
|
||||||
|
"${MINGW_PACKAGE_PREFIX}-python-wheel")
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${NMAP_DIR}/zenmap"
|
||||||
|
${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
|
||||||
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "${NMAP_DIR}/zenmap"
|
cd "${NMAP_DIR}/zenmap"
|
||||||
|
|
||||||
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
||||||
${MINGW_PREFIX}/bin/python -m pip install --no-deps --force-reinstall --prefix=${MINGW_PREFIX} --root="${pkgdir}" .
|
${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
|
||||||
|
--destdir="${pkgdir}" dist/*.whl
|
||||||
|
|
||||||
install -Dm644 install_scripts/unix/zenmap.desktop "${pkgdir}${MINGW_PREFIX}/share/applications/zenmap.desktop"
|
install -Dm644 install_scripts/unix/zenmap.desktop "${pkgdir}${MINGW_PREFIX}/share/applications/zenmap.desktop"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,14 +36,18 @@ pip3 install .
|
|||||||
# make the minimal msys2 environment
|
# make the minimal msys2 environment
|
||||||
#styrene -p . -o "$BUILDDIR" styrene.cfg --no-exe --no-zip
|
#styrene -p . -o "$BUILDDIR" styrene.cfg --no-exe --no-zip
|
||||||
|
|
||||||
|
PYTHON_VER=3.11
|
||||||
PACKAGEDIR=$BUILDDIR/zenmap-w64/mingw64
|
PACKAGEDIR=$BUILDDIR/zenmap-w64/mingw64
|
||||||
PYTHONLIB=$(ls -d $PACKAGEDIR/lib/python3.*)
|
PYTHON_SUBDIR=lib/python$PYTHON_VER
|
||||||
|
PYTHONLIB=$PACKAGEDIR/$PYTHON_SUBDIR
|
||||||
|
|
||||||
# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
|
# Remove compiled bytecode, recompile in legacy locations, allowing for removal of source.
|
||||||
# See PEP-3147
|
# See PEP-3147
|
||||||
find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
|
find "$PYTHONLIB" -depth \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o -name __pycache__ -exec rm -rf '{}' \;
|
||||||
# Exit code not reliable
|
# Exit code not reliable
|
||||||
python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "$PYTHONLIB" #|| true
|
pushd "$PACKAGEDIR/bin"
|
||||||
|
python -m compileall -b -x 'zenmapGUI|zenmapCore|radialnet' "../$PYTHON_SUBDIR" #|| true
|
||||||
|
popd
|
||||||
|
|
||||||
# Remove source if compiled is available, except for Zenmap itself:
|
# 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
|
find "$PYTHONLIB" \( -name 'zenmap*' -o -name 'radialnet' \) -prune -o \( -name '*.pyc' -print \) | while read pyc; do
|
||||||
@@ -53,7 +57,9 @@ done
|
|||||||
# Now compile Zenmap using default (not legacy) location.
|
# Now compile Zenmap using default (not legacy) location.
|
||||||
# If we had used legacy location, python.exe tries to write out the PEP-3147
|
# If we had used legacy location, python.exe tries to write out the PEP-3147
|
||||||
# location anyway when source is available.
|
# location anyway when source is available.
|
||||||
python -m compileall "$PYTHONLIB"/site-packages #|| true
|
pushd "$PACKAGEDIR/bin"
|
||||||
|
python -m compileall "../$PYTHON_SUBDIR"/site-packages #|| true
|
||||||
|
popd
|
||||||
|
|
||||||
# Remove some of the larger unused items
|
# Remove some of the larger unused items
|
||||||
rm -f "$PACKAGEDIR"/bin/win7appid.exe
|
rm -f "$PACKAGEDIR"/bin/win7appid.exe
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
packages = {pkg_prefix}python-zenmap {pkg_prefix}python-gobject {pkg_prefix}python {pkg_prefix}gtk3 msys2-runtime
|
packages = {pkg_prefix}python-zenmap {pkg_prefix}python-gobject {pkg_prefix}python {pkg_prefix}gtk3 msys2-runtime
|
||||||
|
|
||||||
# Reduce some bundling time and size by skipping these prereqs we don't use
|
# Reduce some bundling time and size by skipping these prereqs we don't use
|
||||||
assume_installed = {pkg_prefix}ncurses {pkg_prefix}expat {pkg_prefix}openssl {pkg_prefix}tcl {pkg_prefix}tk
|
assume_installed = {pkg_prefix}ncurses {pkg_prefix}openssl {pkg_prefix}tcl {pkg_prefix}tk
|
||||||
|
|
||||||
# The first part of generated installer or archive filenames.
|
# The first part of generated installer or archive filenames.
|
||||||
# Will be suffixed with the version, an architecture spec
|
# Will be suffixed with the version, an architecture spec
|
||||||
@@ -70,8 +70,9 @@ nodelete =
|
|||||||
mingw*/etc/gtk-3.0
|
mingw*/etc/gtk-3.0
|
||||||
# Required DLLs. Checked with:
|
# Required DLLs. Checked with:
|
||||||
# * recursive `dumpbin /imports` on known python/gtk dlls
|
# * recursive `dumpbin /imports` on known python/gtk dlls
|
||||||
# * recursive `dumpbin /imports` on pyd files in lib/python3.10
|
# * recursive `dumpbin /imports` on pyd files in lib/python3.11
|
||||||
# * `g-ir-inspect --print-shlibs` for typelibs listed below
|
# * `g-ir-inspect --print-shlibs` for typelibs listed below
|
||||||
|
mingw*/bin/libpython3.11.dll
|
||||||
mingw*/bin/libatk-1.0-0.dll
|
mingw*/bin/libatk-1.0-0.dll
|
||||||
mingw*/bin/libbrotlicommon.dll
|
mingw*/bin/libbrotlicommon.dll
|
||||||
mingw*/bin/libbrotlidec.dll
|
mingw*/bin/libbrotlidec.dll
|
||||||
@@ -106,7 +107,6 @@ nodelete =
|
|||||||
mingw*/bin/libpcre2-8-0.dll
|
mingw*/bin/libpcre2-8-0.dll
|
||||||
mingw*/bin/libpixman-1-0.dll
|
mingw*/bin/libpixman-1-0.dll
|
||||||
mingw*/bin/libpng16-16.dll
|
mingw*/bin/libpng16-16.dll
|
||||||
mingw*/bin/libpython3.10.dll
|
|
||||||
mingw*/bin/libsqlite3-0.dll
|
mingw*/bin/libsqlite3-0.dll
|
||||||
mingw*/bin/libstdc++-6.dll
|
mingw*/bin/libstdc++-6.dll
|
||||||
mingw*/bin/libthai-0.dll
|
mingw*/bin/libthai-0.dll
|
||||||
@@ -144,17 +144,17 @@ nodelete =
|
|||||||
mingw*/bin/python.exe
|
mingw*/bin/python.exe
|
||||||
# Zenmap's files (mostly in site-packages above)
|
# Zenmap's files (mostly in site-packages above)
|
||||||
# mingw*/bin/zenmap
|
# mingw*/bin/zenmap
|
||||||
mingw*/lib/python3.*/site-packages/zenmapCore
|
mingw*/lib/python3.11/site-packages/zenmapCore
|
||||||
mingw*/lib/python3.*/site-packages/zenmapGUI
|
mingw*/lib/python3.11/site-packages/zenmapGUI
|
||||||
mingw*/lib/python3.*/site-packages/radialnet
|
mingw*/lib/python3.11/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.11
|
||||||
# mingw*/lib/python3.*/encodings
|
# mingw*/lib/python3.11/encodings
|
||||||
# mingw*/lib/python3.*/site.py
|
# mingw*/lib/python3.11/site.py
|
||||||
# mingw*/lib/python3.*/_sitebuiltins.py
|
# mingw*/lib/python3.11/_sitebuiltins.py
|
||||||
# mingw*/lib/python3.*/site-packages/gi
|
# mingw*/lib/python3.11/site-packages/gi
|
||||||
# mingw*/lib/python3.*/site-packages/cairo
|
# mingw*/lib/python3.11/site-packages/cairo
|
||||||
|
|
||||||
# Local launcher definitions
|
# Local launcher definitions
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ nodelete =
|
|||||||
; All launchers need to be listed in the [bundle]'s "launchers" key.
|
; All launchers need to be listed in the [bundle]'s "launchers" key.
|
||||||
[zenmap.desktop]
|
[zenmap.desktop]
|
||||||
exec = pythonw.exe -c 'from zenmapGUI.App import run; run()'
|
exec = pythonw.exe -c 'from zenmapGUI.App import run; run()'
|
||||||
icon = {msystem_subdir}/share/zenmap/pixmaps/zenmap.png
|
icon = mingw*/lib/python3.11/site-packages/zenmap/zenmapCore/data/pixmaps/zenmap.png
|
||||||
; For debugging:
|
; For debugging:
|
||||||
;Terminal = true
|
;Terminal = true
|
||||||
;exec = python.exe -c 'from zenmapGUI.App import run; run()' -vvvvv
|
;exec = python.exe -c 'from zenmapGUI.App import run; run()' -vvvvv
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ import sys
|
|||||||
import configparser
|
import configparser
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
# https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
|
||||||
|
if os.add_dll_directory:
|
||||||
|
os.add_dll_directory(os.path.dirname(sys.executable))
|
||||||
|
|
||||||
# Cause an exception if PyGTK can't open a display. Normally this just
|
# Cause an exception if PyGTK can't open a display. Normally this just
|
||||||
# produces a warning, but the lack of a display eventually causes a
|
# produces a warning, but the lack of a display eventually causes a
|
||||||
# segmentation fault. See http://live.gnome.org/PyGTK/WhatsNew210.
|
# segmentation fault. See http://live.gnome.org/PyGTK/WhatsNew210.
|
||||||
|
|||||||
Reference in New Issue
Block a user