From 0f34a5b42fb6dbbcefcc166a4ad71e8502960cdc Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Tue, 27 Sep 2016 14:54:12 -0400 Subject: [pkg] re-add binary launcher to bundle process --- pkg/launcher/.gitignore | 2 ++ pkg/launcher/Makefile | 15 +++++++++++++++ pkg/launcher/README.rst | 14 ++++++++++++++ pkg/launcher/bitmask-launcher.c | 23 +++++++++++++++++++++++ pkg/pyinst/Makefile | 3 +++ 5 files changed, 57 insertions(+) create mode 100644 pkg/launcher/.gitignore create mode 100644 pkg/launcher/Makefile create mode 100644 pkg/launcher/README.rst create mode 100644 pkg/launcher/bitmask-launcher.c (limited to 'pkg') diff --git a/pkg/launcher/.gitignore b/pkg/launcher/.gitignore new file mode 100644 index 0000000..60de46d --- /dev/null +++ b/pkg/launcher/.gitignore @@ -0,0 +1,2 @@ +*.o +bitmask diff --git a/pkg/launcher/Makefile b/pkg/launcher/Makefile new file mode 100644 index 0000000..8dd1013 --- /dev/null +++ b/pkg/launcher/Makefile @@ -0,0 +1,15 @@ +CC = gcc +CFLAGS = -g -Wall +STRIP = strip + +default: bitmask + +bitmask.o: bitmask-launcher.c + $(CC) $(CFLAGS) -c bitmask-launcher.c -o bitmask.o + +bitmask: bitmask.o + $(CC) bitmask.o -o bitmask + $(STRIP) bitmask +clean: + -rm -f bitmask.o + -rm -f bitmask diff --git a/pkg/launcher/README.rst b/pkg/launcher/README.rst new file mode 100644 index 0000000..9a840de --- /dev/null +++ b/pkg/launcher/README.rst @@ -0,0 +1,14 @@ +bitmask-launcher.c +------------------ + +A small, portable launcher for bitmask bundles. + +Problem that solves +------------------- +PyInstaller bundles leave everything (libs, data and the main binary) in a +single folder. In a case like ours, there are too many files cluttering this +top-most folder. + +We wanted to have a cleaner folder, with an obviously clickable entrypoint, that +calls the binary that hides in an inferior folder. + diff --git a/pkg/launcher/bitmask-launcher.c b/pkg/launcher/bitmask-launcher.c new file mode 100644 index 0000000..cf5c2a1 --- /dev/null +++ b/pkg/launcher/bitmask-launcher.c @@ -0,0 +1,23 @@ +/* + * bitmask-launcher.c + * + * part of the bitmask bundle. + * execute main entrypoint in a child folder inside the bundle. + * + * (c) LEAP Encryption Access Project, 2016. + * License: GPL. + * +*/ + +#include +#include + +char* const bitmask_path = "lib"; +char* const entrypoint = "bitmask"; + +int main(int argc, char *argv[]) +{ + argv[0] = entrypoint; + chdir(bitmask_path); + execv(entrypoint, argv); +} diff --git a/pkg/pyinst/Makefile b/pkg/pyinst/Makefile index 41599a4..e8d52f8 100644 --- a/pkg/pyinst/Makefile +++ b/pkg/pyinst/Makefile @@ -4,6 +4,9 @@ build: clean cp ../../src/leap/bitmask/core/bitmaskd.tac dist/bitmask mkdir dist/bitmask/leap cp -r $(VIRTUAL_ENV)/lib/python2.7/site-packages/leap/bitmask_js/ dist/bitmask/leap + mv dist/bitmask lib && mkdir dist/bitmask && mv lib dist/bitmask/lib + cd ../launcher && make + cp ../launcher/bitmask dist/bitmask/ clean: rm -rf dist build -- cgit v1.2.3