Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 4c12199029e0df47a209d10ac14a9cb6a937b4bc @probonopd committed Sep 14, 2016
Showing with 1,002 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +60 −0 build.sh
  4. +360 −0 md5.c
  5. +115 −0 md5.h
  6. +376 −0 runtime.c
  7. +1 −0 squashfuse
  8. +56 −0 squashfuse-patches/Makefile.am.patch
  9. +29 −0 squashfuse-patches/ll.c.patch
@@ -0,0 +1,2 @@
+# Build directory
+build/
@@ -0,0 +1,3 @@
+[submodule "squashfuse"]
+ path = squashfuse
+ url = https://github.com/vasi/squashfuse.git
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# Clean up from previous run
+rm -rf build/ || true
+
+# Install build dependencies
+
+sudo apt-get -y install git autoconf libtool make gcc libtool libtool-bin libfuse-dev liblzma-dev
+
+# Patch squashfuse_ll to be a library rather than an executable
+
+cd squashfuse
+patch -p1 < ../squashfuse-patches/ll.c.patch
+patch -p1 < ../squashfuse-patches/Makefile.am.patch
+
+# Build libsquashfuse_ll library
+
+libtoolize --force
+aclocal
+autoheader
+automake --force-missing --add-missing
+autoconf
+
+./configure --with-xz=/usr/lib/
+
+sed -i -e 's|-O2|-Os|g' squashfuse/Makefile # Optimize for size
+
+make
+
+cd ..
+
+mkdir build
+cd build
+
+# Compile runtime but do not link
+
+cc -D_FILE_OFFSET_BITS=64 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -Os -c ../runtime.c
+
+# Now statically link against libsquashfuse_ll, libsquashfuse and liblzma
+
+cc runtime.o ../squashfuse/.libs/libsquashfuse_ll.a ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -Wl,-Bdynamic -lfuse -lpthread -lglib-2.0 -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -o runtime
+
+# Insert AppImage magic bytes
+
+printf '\x41\x49\x02' | dd of=runtime bs=1 seek=8 count=3 conv=notrunc
+
+cd ..
+
+# Reset squashfuse to its original state
+
+cd squashfuse
+git reset --hard
+cd -
+
+# Strip runtime and check its size and dependencies
+
+strip build/runtime
+ldd build/runtime
+ls -l build/runtime
+
Oops, something went wrong.

0 comments on commit 4c12199

Please sign in to comment.