3 # This script installs the required build-time dependencies
4 # and builds AppImageTool on OSX
7 small_FLAGS
="-Os -ffunction-sections -fdata-sections"
8 CC
="cc -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result"
18 HERE
="$(dirname "$
(readlink
-f "${0}")")"
21 # Fetch git submodules
25 # Clean up from previous run
28 # Build lzma always static because the runtime gets distributed with
29 # the generated .AppImage file.
30 if [ ! -e "./xz-5.2.3/build/lib/liblzma.a" ] ; then
31 wget
-c http
://tukaani.org
/xz
/xz-5.2
.3.
tar.gz
32 tar xf xz-5.2
.3.
tar.gz
35 CFLAGS
="-Wall $small_FLAGS" .
/configure
--prefix=$
(pwd)/build
--libdir=$
(pwd)/build
/lib
--enable-static --disable-shared
36 make -j$JOBS && make install
40 # Patch squashfuse_ll to be a library rather than an executable
43 if [ ! -e .
/ll.c.orig
]; then
44 patch -p1 --backup < ..
/squashfuse.
patch
45 patch -p1 --backup < ..
/squashfuse_dlopen.
patch
47 if [ ! -e .
/squashfuse_dlopen.c
]; then
48 cp ..
/squashfuse_dlopen.c .
50 if [ ! -e .
/squashfuse_dlopen.h
]; then
51 cp ..
/squashfuse_dlopen.h .
54 # Build libsquashfuse_ll library
56 if [ ! -e .
/Makefile
] ; then
57 export ACLOCAL_FLAGS
="-I /usr/share/aclocal"
61 automake
--force-missing --add-missing
62 autoreconf
-fi || true
# Errors out, but the following succeeds then?
64 sed -i "" '/PKG_CHECK_MODULES.*/,/,:./d' configure
# https://github.com/vasi/squashfuse/issues/12
65 CFLAGS
="-Wall $small_FLAGS" .
/configure
--disable-demo --disable-high-level --without-lzo --without-lz4 --with-xz=$
(pwd)/..
/xz-5.2
.3/build
67 # Patch Makefile to use static lzma
68 sed -i "" "s|XZ_LIBS = -llzma -L$(pwd)/../xz-5.2.3/build/lib|XZ_LIBS = -Bstatic -llzma -L$(pwd)/../xz-5.2.3/build/lib|g" Makefile
77 # Build mksquashfs with -offset option to skip n bytes
78 # https://github.com/plougher/squashfs-tools/pull/13
80 if [ ! -e squashfs-tools
/action.c.orig
] ; then
81 patch -p1 --backup < ..
/squashfs_osx.
patch
85 # Patch squashfuse-tools Makefile to link against static llzma
86 sed -i "" "s|CFLAGS += -DXZ_SUPPORT|CFLAGS += -DXZ_SUPPORT -I../../xz-5.2.3/build/include|g" Makefile
87 sed -i "" "s|LIBS += -llzma|LIBS += -Bstatic -llzma -L../../xz-5.2.3/build/lib|g" Makefile
89 make -j$JOBS XZ_SUPPORT
=1 mksquashfs
# LZ4_SUPPORT=1 did not build yet on CentOS 6
99 cp ..
/squashfs-tools
/squashfs-tools
/mksquashfs .
102 # Compile appimagetool but do not link - glib version
104 $CC -DGIT_COMMIT=\"$
(git describe
--tags --always --abbrev=7)\" -D_FILE_OFFSET_BITS=64 -I..
/squashfuse
/ \
105 $
(pkg-config
--cflags glib-2.0
) -g -Os ..
/getsection.c
-c ..
/appimagetool.c
107 # Now statically link against libsquashfuse - glib version
109 # statically link against liblzma
110 $CC -o appimagetool appimagetool.o ..
/elf.c ..
/getsection.c
-DENABLE_BINRELOC ..
/binreloc.c \
111 ..
/squashfuse
/.libs
/libsquashfuse.a ..
/squashfuse
/.libs
/libfuseprivate.a \
112 -L..
/xz-5.2
.3/build
/lib \
114 $
(pkg-config
--cflags --libs glib-2.0
) -lz -llzma