From 7e89e670ec0baac063c52c4f6d3690eb6e6130ad Mon Sep 17 00:00:00 2001 From: kali Date: Sat, 5 Aug 2017 15:20:48 -0700 Subject: [pkg] move bundling scripts --- Makefile | 10 +---- pkg/bundles/README.rst | 13 ++++++ pkg/bundles/build.mk | 94 +++++++++++++++++++++++++++++++++++++++++++ pkg/bundles/win_postbuild.bat | 11 +++++ pkg/pyinst/Makefile | 1 - pkg/pyinst/build.mk | 87 --------------------------------------- pkg/pyinst/win_postbuild.bat | 11 ----- 7 files changed, 119 insertions(+), 108 deletions(-) create mode 100644 pkg/bundles/README.rst create mode 100644 pkg/bundles/build.mk create mode 100644 pkg/bundles/win_postbuild.bat delete mode 100644 pkg/pyinst/Makefile delete mode 100644 pkg/pyinst/build.mk delete mode 100644 pkg/pyinst/win_postbuild.bat diff --git a/Makefile b/Makefile index 95aa8403..347c4083 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ DIST=dist/bitmask NEXT_VERSION = $(shell cat pkg/next-version) DIST_VERSION = dist/bitmask-$(NEXT_VERSION)/ -OSX_CERT = "Developer ID Installer: LEAP Encryption Access Project" -include pkg/pyinst/build.mk +include pkg/bundles/build.mk include pkg/thirdparty/openvpn/build.mk dev-bootstrap: @@ -70,13 +69,6 @@ bundle_in_docker: docker_container: cd pkg/docker_bundle && docker build -t mybundle . -osx_pkg: - pkg/osx/quickpkg --output dist/Bitmask-$(NEXT_VERSION)_pre.pkg --scripts pkg/osx/scripts/ dist/Bitmask.app/ - productsign --sign $(OSX_CERT) dist/Bitmask-$(NEXT_VERSION)_pre.pkg dist/Bitmask-$(NEXT_VERSION).pkg - -cleanpkg: - rm -rf dist build - clean: find . -type f -name "*.py[co]" -delete find . -type d -name "__pycache__" -delete diff --git a/pkg/bundles/README.rst b/pkg/bundles/README.rst new file mode 100644 index 00000000..d7754355 --- /dev/null +++ b/pkg/bundles/README.rst @@ -0,0 +1,13 @@ +bundle utilities +---------------- +In this folder there are several makefile/batch scripts that are used during +the bundling process. + +The bundles are first generated by PyInstaller (using the spec file in +``pkg/pyinst``), and then we arrange the various helpers in a way that is +specific to every platform. + +The scripts in this folder are expected to be called from the root folder of +the project, and therefore all the paths are relative paths to the root folder. + + diff --git a/pkg/bundles/build.mk b/pkg/bundles/build.mk new file mode 100644 index 00000000..158293b1 --- /dev/null +++ b/pkg/bundles/build.mk @@ -0,0 +1,94 @@ +# This makefile should be called from the topmost bitmask folder +# +OSX_RES = dist/Bitmask.app/Contents/Resources +OSX_CON = dist/Bitmask.app/Contents/MacOS +OSX_CERT = "Developer ID Installer: LEAP Encryption Access Project" + + +default: + echo "enter 'make bundle or make bundle_osx'" + +bundle: bundle_clean + pyinstaller -y pkg/pyinst/app.spec + cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/_scrypt.so $(DIST) + cp src/leap/bitmask/core/bitmaskd.tac $(DIST) + mkdir -p $(DIST)/leap + # if you find yourself puzzled becase the following files are not found in your + # virtualenv, make sure that you're installing the packages from wheels and not eggs. + mkdir -p $(DIST)/leap/soledad/client/_db + cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/soledad/client/_db/dbschema.sql $(DIST)/leap/soledad/client/_db/ + cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/common/cacert.pem $(DIST)/ + cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/bitmask_js $(DIST)/leap/ + cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/pixelated_www $(DIST)/leap/ + mv $(DIST) _bundlelib && mkdir $(DIST_VERSION) && mv _bundlelib $(DIST_VERSION)/lib/ + cd pkg/launcher && make + cp pkg/launcher/bitmask $(DIST_VERSION) + +bundle_linux_gpg: + # TODO build it in a docker container! + mkdir -p $(DIST_VERSION)/apps/mail + # this is /usr/bin/gpg1 in debian stretch + cp /usr/bin/gpg $(DIST_VERSION)/apps/mail/gpg + # workaround for missing libreadline.so.6 in fresh ubuntu + patchelf --set-rpath '.' $(DIST_VERSION)/apps/mail/gpg + cp /lib/x86_64-linux-gnu/libusb-0.1.so.4 $(DIST_VERSION)/lib + +bundle_linux_vpn: + mkdir -p $(DIST_VERSION)/apps/vpn + # TODO verify signature + wget https://downloads.leap.se/thirdparty/linux/openvpn/openvpn -O $(DIST_VERSION)/apps/vpn/openvpn.leap + +bundle_linux_helpers: + mkdir -p $(DIST_VERSION)/apps/helpers + cp src/leap/bitmask/vpn/helpers/linux/bitmask-root $(DIST_VERSION)/apps/helpers/ + cp src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.bundle.policy $(DIST_VERSION)/apps/helpers/ + cp /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 $(DIST_VERSION)/lib/libGL.so.1 || echo "libGL version not found" + +bundle_osx_helpers: + mkdir -p $(DIST_VERSION)/apps/helpers + cp src/leap/bitmask/vpn/helpers/osx/bitmask-helper $(DIST_VERSION)/apps/helpers/ + cp src/leap/bitmask/vpn/helpers/osx/bitmask.pf.conf $(DIST_VERSION)/apps/helpers/ + cp pkg/osx/scripts/se.leap.bitmask-helper.plist $(DIST_VERSION)/apps/helpers/ + cp -r pkg/osx/daemon $(DIST_VERSION)/apps/helpers/ + cp -r pkg/osx/openvpn $(DIST_VERSION)/apps/helpers/ + +bundle_osx_missing: + cp $(DIST_VERSION)/lib/_scrypt.so $(OSX_CON)/ + cp $(DIST_VERSION)/lib/bitmaskd.tac $(OSX_CON)/ + cp -r $(DIST_VERSION)/lib/leap $(OSX_CON)/ + mv dist/Bitmask.app/Contents/MacOS/bitmask $(OSX_CON)/bitmask-app + cp pkg/osx/bitmask-wrapper $(OSX_CON)/bitmask + mkdir -p $(OSX_RES)/bitmask-helper + cp -r $(DIST_VERSION)/apps/helpers/bitmask-helper $(OSX_RES)/bitmask-helper/ + cp -r $(DIST_VERSION)/apps/helpers/bitmask.pf.conf $(OSX_RES)/bitmask-helper/ + cp -r $(DIST_VERSION)/apps/helpers/daemon/daemon.py $(OSX_RES)/bitmask-helper/ + cp -r $(DIST_VERSION)/apps/helpers/openvpn/* $(OSX_RES)/ + wget https://downloads.leap.se/thirdparty/osx/openvpn/openvpn -O $(OSX_RES)/openvpn.leap + chmod +x $(OSX_RES)/openvpn.leap + +bundle_osx_pkg: + pkg/osx/quickpkg --output dist/Bitmask-$(NEXT_VERSION)_pre.pkg --scripts pkg/osx/scripts/ dist/Bitmask.app/ + productsign --sign $(OSX_CERT) dist/Bitmask-$(NEXT_VERSION)_pre.pkg dist/Bitmask-$(NEXT_VERSION).pkg + + +bundle_linux: bundle bundle_linux_gpg bundle_linux_vpn bundle_linux_helpers + +bundle_osx: bundle bundle_osx_helpers bundle_osx_missing bundle_osx_pkg + +bundle_win: + pyinstaller -y pkg/pyinst/app.spec + cp ${VIRTUAL_ENV}/Lib/site-packages/_scrypt.pyd $(DIST) + cp ${VIRTUAL_ENV}/Lib/site-packages/zmq/libzmq.pyd $(DIST) + cp src/leap/bitmask/core/bitmaskd.tac $(DIST) + +bundle_tar: + cd dist/ && tar cvzf Bitmask.$(NEXT_VERSION).tar.gz bitmask-$(NEXT_VERSION) + +bundle_sign: + gpg2 -a --sign --detach-sign dist/Bitmask.$(NEXT_VERSION).tar.gz + +bundle_upload: + rsync --rsh='ssh' -avztlpog --progress --partial dist/Bitmask.$(NEXT_VERSION).* downloads.leap.se:./ + +bundle_clean: + rm -rf "dist" "build" diff --git a/pkg/bundles/win_postbuild.bat b/pkg/bundles/win_postbuild.bat new file mode 100644 index 00000000..c4d9fb01 --- /dev/null +++ b/pkg/bundles/win_postbuild.bat @@ -0,0 +1,11 @@ +SET DIST=%CD%\dist\bitmask +cp %VIRTUAL_ENV%/Lib/site-packages/_scrypt.pyd %DIST% +cp %VIRTUAL_ENV%/Lib/site-packages/zmq/libzmq.pyd %DIST% +cp %VIRTUAL_ENV%/Lib/site-packages/leap/common/cacert.pem %DIST% +cp %CD%\src\leap\bitmask\core\bitmaskd.tac %DIST% +mkdir %DIST%\leap +mkdir %DIST%\leap\soledad\common\l2db\backends +mkdir %DIST%\apps\mail +cp %CD%/../gpg/* %DIST%\apps\mail\ +cp %VIRTUAL_ENV%/Lib/site-packages/leap/soledad/common/l2db/backends/dbschema.sql %DIST%\leap\soledad\common\l2db\backends +cp -r %VIRTUAL_ENV%/Lib/site-packages/leap/bitmask_js %DIST%\leap\ diff --git a/pkg/pyinst/Makefile b/pkg/pyinst/Makefile deleted file mode 100644 index 1acde6dc..00000000 --- a/pkg/pyinst/Makefile +++ /dev/null @@ -1 +0,0 @@ -include build.mk diff --git a/pkg/pyinst/build.mk b/pkg/pyinst/build.mk deleted file mode 100644 index 2ad224b4..00000000 --- a/pkg/pyinst/build.mk +++ /dev/null @@ -1,87 +0,0 @@ -# This makefile should be called from the topmost bitmask folder -# -OSX_RES = dist/Bitmask.app/Contents/Resources -OSX_CON = dist/Bitmask.app/Contents/MacOS - - -default: - echo "enter 'make bundle or make bundle_osx'" - -bundle: bundle_clean - pyinstaller -y pkg/pyinst/app.spec - cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/_scrypt.so $(DIST) - cp src/leap/bitmask/core/bitmaskd.tac $(DIST) - mkdir -p $(DIST)/leap - # if you find yourself puzzled becase the following files are not found in your - # virtualenv, make sure that you're installing the packages from wheels and not eggs. - mkdir -p $(DIST)/leap/soledad/client/_db - cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/soledad/client/_db/dbschema.sql $(DIST)/leap/soledad/client/_db/ - cp $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/common/cacert.pem $(DIST)/ - cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/bitmask_js $(DIST)/leap/ - cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/pixelated_www $(DIST)/leap/ - mv $(DIST) _bundlelib && mkdir $(DIST_VERSION) && mv _bundlelib $(DIST_VERSION)/lib/ - cd pkg/launcher && make - cp pkg/launcher/bitmask $(DIST_VERSION) - -bundle_linux_gpg: - # TODO build it in a docker container! - mkdir -p $(DIST_VERSION)/apps/mail - # this is /usr/bin/gpg1 in debian stretch - cp /usr/bin/gpg $(DIST_VERSION)/apps/mail/gpg - # workaround for missing libreadline.so.6 in fresh ubuntu - patchelf --set-rpath '.' $(DIST_VERSION)/apps/mail/gpg - cp /lib/x86_64-linux-gnu/libusb-0.1.so.4 $(DIST_VERSION)/lib - -bundle_linux_vpn: - mkdir -p $(DIST_VERSION)/apps/vpn - # TODO verify signature - wget https://downloads.leap.se/thirdparty/linux/openvpn/openvpn -O $(DIST_VERSION)/apps/vpn/openvpn.leap - -bundle_linux_helpers: - mkdir -p $(DIST_VERSION)/apps/helpers - cp src/leap/bitmask/vpn/helpers/linux/bitmask-root $(DIST_VERSION)/apps/helpers/ - cp src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.bundle.policy $(DIST_VERSION)/apps/helpers/ - cp /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 $(DIST_VERSION)/lib/libGL.so.1 || echo "libGL version not found" - -bundle_osx_helpers: - mkdir -p $(DIST_VERSION)/apps/helpers - cp src/leap/bitmask/vpn/helpers/osx/bitmask-helper $(DIST_VERSION)/apps/helpers/ - cp src/leap/bitmask/vpn/helpers/osx/bitmask.pf.conf $(DIST_VERSION)/apps/helpers/ - cp pkg/osx/scripts/se.leap.bitmask-helper.plist $(DIST_VERSION)/apps/helpers/ - cp -r pkg/osx/daemon $(DIST_VERSION)/apps/helpers/ - cp -r pkg/osx/openvpn $(DIST_VERSION)/apps/helpers/ - - -bundle_linux: bundle bundle_linux_gpg bundle_linux_vpn bundle_linux_helpers - -bundle_osx: bundle bundle_osx_helpers - cp $(DIST_VERSION)/lib/_scrypt.so $(OSX_CON)/ - cp $(DIST_VERSION)/lib/bitmaskd.tac $(OSX_CON)/ - cp -r $(DIST_VERSION)/lib/leap $(OSX_CON)/ - mv dist/Bitmask.app/Contents/MacOS/bitmask $(OSX_CON)/bitmask-app - cp pkg/osx/bitmask-wrapper $(OSX_CON)/bitmask - mkdir -p $(OSX_RES)/bitmask-helper - cp -r $(DIST_VERSION)/apps/helpers/bitmask-helper $(OSX_RES)/bitmask-helper/ - cp -r $(DIST_VERSION)/apps/helpers/bitmask.pf.conf $(OSX_RES)/bitmask-helper/ - cp -r $(DIST_VERSION)/apps/helpers/daemon/daemon.py $(OSX_RES)/bitmask-helper/ - cp -r $(DIST_VERSION)/apps/helpers/openvpn/* $(OSX_RES)/ - wget https://downloads.leap.se/thirdparty/osx/openvpn/openvpn -O $(OSX_RES)/openvpn.leap - chmod +x $(OSX_RES)/openvpn.leap - -bundle_win: - pyinstaller -y pkg/pyinst/app.spec - cp ${VIRTUAL_ENV}/Lib/site-packages/_scrypt.pyd $(DIST) - cp ${VIRTUAL_ENV}/Lib/site-packages/zmq/libzmq.pyd $(DIST) - cp src/leap/bitmask/core/bitmaskd.tac $(DIST) - -bundle_tar: - cd dist/ && tar cvzf Bitmask.$(NEXT_VERSION).tar.gz bitmask-$(NEXT_VERSION) - -bundle_sign: - gpg2 -a --sign --detach-sign dist/Bitmask.$(NEXT_VERSION).tar.gz - -bundle_upload: - rsync --rsh='ssh' -avztlpog --progress --partial dist/Bitmask.$(NEXT_VERSION).* downloads.leap.se:./ - -bundle_clean: - rm -rf "dist" "build" diff --git a/pkg/pyinst/win_postbuild.bat b/pkg/pyinst/win_postbuild.bat deleted file mode 100644 index c4d9fb01..00000000 --- a/pkg/pyinst/win_postbuild.bat +++ /dev/null @@ -1,11 +0,0 @@ -SET DIST=%CD%\dist\bitmask -cp %VIRTUAL_ENV%/Lib/site-packages/_scrypt.pyd %DIST% -cp %VIRTUAL_ENV%/Lib/site-packages/zmq/libzmq.pyd %DIST% -cp %VIRTUAL_ENV%/Lib/site-packages/leap/common/cacert.pem %DIST% -cp %CD%\src\leap\bitmask\core\bitmaskd.tac %DIST% -mkdir %DIST%\leap -mkdir %DIST%\leap\soledad\common\l2db\backends -mkdir %DIST%\apps\mail -cp %CD%/../gpg/* %DIST%\apps\mail\ -cp %VIRTUAL_ENV%/Lib/site-packages/leap/soledad/common/l2db/backends/dbschema.sql %DIST%\leap\soledad\common\l2db\backends -cp -r %VIRTUAL_ENV%/Lib/site-packages/leap/bitmask_js %DIST%\leap\ -- cgit v1.2.3