kopia lustrzana https://github.com/inkstitch/inkstitch
break build out into a script
rodzic
e6b8be86e9
commit
b6d0d100ad
41
Makefile
41
Makefile
|
@ -4,46 +4,9 @@ TARBALL:=inkstitch-$(VERSION)-$(shell uname)-$(shell uname -m).tar.gz
|
|||
SITE_PACKAGES:=$(shell python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")
|
||||
|
||||
dist: distclean
|
||||
mkdir -p dist/inkstitch/bin
|
||||
for extension in $(EXTENSIONS); do \
|
||||
\
|
||||
`# without this, it seems that pyinstaller can't find all of wxpython's shared libraries` \
|
||||
export LD_LIBRARY_PATH="$(SITE_PACKAGES)/wx"; \
|
||||
pyinstaller \
|
||||
\
|
||||
`# pyinstaller misses these two` \
|
||||
--add-binary /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so:. \
|
||||
--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. \
|
||||
\
|
||||
\
|
||||
`# This one's tricky. ink/stitch doesn't actually _use_ gi.repository.Gtk, ` \
|
||||
`# but it does use GTK (through wxPython). pyinstaller has some special ` \
|
||||
`# logic to handle GTK apps that is engaged when you import ` \
|
||||
`# gi.repository.Gtk that pulls in things like themes, icons, etc. Without ` \
|
||||
`# that, the Params dialog is unthemed and barely usable. This hidden ` \
|
||||
`# import option is actually the only reason we had to install python-gi ` \
|
||||
`# above! ` \
|
||||
--hidden-import gi.repository.Gtk \
|
||||
\
|
||||
`# This lets pyinstaller see inkex.py, etc. ` \
|
||||
-p /usr/share/inkscape/extensions \
|
||||
$${extension}.py; \
|
||||
\
|
||||
`# By default, pyinstaller will treat each of ink/stitch's extensions ` \
|
||||
`# separately. This means it packages a lot of the same shared libraries (like ` \
|
||||
`# wxPython) multiple times. Turns out that we can just copy the contents of ` \
|
||||
`# the directories pyinstaller creates into one and it works fine, eliminating ` \
|
||||
`# the duplication. This significantly decreases the size of the inkstitch ` \
|
||||
`# tarball/zip. ` \
|
||||
cp -a dist/$${extension}/* dist/inkstitch/bin; \
|
||||
rm -rf dist/$${extension}; \
|
||||
\
|
||||
`# Inkscape doesn't let us run native binaries as extensions(?!). Instead we ` \
|
||||
`# add this stub script which executes the binaries that pyinstaller creates. ` \
|
||||
cp stub.py dist/$${extension}.py; \
|
||||
done;
|
||||
bin/build-dist $(EXTENSIONS)
|
||||
cp *.inx dist
|
||||
cd dist; tar zcf ../$(TARBALL) *
|
||||
(cd dist; tar zcf ../$(TARBALL) *)
|
||||
|
||||
# This is only here for debugging the build.
|
||||
tar zcf build.tar.gz build
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")"
|
||||
|
||||
# pyinstaller misses these two
|
||||
pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so:. "
|
||||
pyinstaller_args+="--add-binary /usr/lib/x86_64-linux-gnu/libproxy.so.1:. "
|
||||
|
||||
# This one's tricky. ink/stitch doesn't actually _use_ gi.repository.Gtk,
|
||||
# but it does use GTK (through wxPython). pyinstaller has some special
|
||||
# logic to handle GTK apps that is engaged when you import
|
||||
# gi.repository.Gtk that pulls in things like themes, icons, etc. Without
|
||||
# that, the Params dialog is unthemed and barely usable. This hidden
|
||||
# import option is actually the only reason we had to install python-gi
|
||||
# above!
|
||||
pyinstaller_args+="--hidden-import gi.repository.Gtk "
|
||||
|
||||
# This lets pyinstaller see inkex.py, etc.
|
||||
pyinstaller_args+="-p /usr/share/inkscape/extensions "
|
||||
|
||||
mkdir -p dist/inkstitch/bin
|
||||
for extension in "$@"; do
|
||||
# without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of
|
||||
# wxpython's shared libraries
|
||||
LD_LIBRARY_PATH="${site_packages}/wx" pyinstaller $pyinstaller_args ${extension}.py;
|
||||
|
||||
# By default, pyinstaller will treat each of ink/stitch's extensions
|
||||
# separately. This means it packages a lot of the same shared libraries (like
|
||||
# wxPython) multiple times. Turns out that we can just copy the contents of
|
||||
# the directories pyinstaller creates into one and it works fine, eliminating
|
||||
# the duplication. This significantly decreases the size of the inkstitch
|
||||
# tarball/zip.
|
||||
cp -a dist/${extension}/* dist/inkstitch/bin
|
||||
rm -rf dist/${extension}
|
||||
|
||||
# Inkscape doesn't let us run native binaries as extensions(?!). Instead we
|
||||
# add this stub script which executes the binaries that pyinstaller creates.
|
||||
cp stub.py dist/${extension}.py
|
||||
done
|
Ładowanie…
Reference in New Issue