@@ -22,16 +22,43 @@ git submodule update
2222rm -rf build/ || true
2323
2424# Build inotify-tools; the one from CentOS does not have .a
25-
2625if [ ! -e " ./inotify-tools-3.14/libinotifytools/src/.libs/libinotifytools.a" ] ; then
2726 wget -c http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
2827 tar xf inotify-tools-3.14.tar.gz
2928 cd inotify-tools-3.14
30- ./configure --prefix=/usr && make && sudo make install
29+ mkdir -p build/lib
30+ ./configure --prefix=` pwd` /build --libdir=` pwd` /build/lib
31+ make
32+ make install
3133 cd -
32- sudo rm /usr/* /libinotifytools.so* /usr/local/lib/libinotifytools.so* 2> /dev/null || true # Don't want the dynamic one
3334fi
3435
36+ # Build lzma
37+ if [ ! -e " ./xz-5.2.3/build/lib/liblzma.a" ] ; then
38+ wget http://tukaani.org/xz/xz-5.2.3.tar.gz
39+ tar xf xz-5.2.3.tar.gz
40+ cd xz-5.2.3
41+ mkdir -p build/lib
42+ ./configure --prefix=` pwd` /build --libdir=` pwd` /build/lib --enable-static
43+ make && make install
44+ cd -
45+ fi
46+
47+ # Build openssl
48+ if [ ! -e " ./openssl-1.1.0c/build/lib/libssl.a" ] ; then
49+ wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz
50+ tar xf openssl-1.1.0c.tar.gz
51+ cd openssl-1.1.0c
52+ mkdir -p build/lib
53+ ./config --prefix=` pwd` /build
54+ make && make install
55+ cd -
56+ fi
57+
58+ # Patch squashfuse-tools Makefile to link against static llzma
59+ sed -i " s|CFLAGS += -DXZ_SUPPORT|CFLAGS += -DXZ_SUPPORT -I../../xz-5.2.3/build/include|g" squashfs-tools/squashfs-tools/Makefile
60+ sed -i " s|LIBS += -llzma|LIBS += -L../../xz-5.2.3/build/lib -llzma|g" squashfs-tools/squashfs-tools/Makefile
61+
3562# Patch squashfuse_ll to be a library rather than an executable
3663
3764cd squashfuse
@@ -48,7 +75,7 @@ if [ ! -e ./Makefile ] ; then
4875 autoreconf -fi || true # Errors out, but the following succeeds then?
4976 autoconf
5077 sed -i ' /PKG_CHECK_MODULES.*/,/,:./d' configure # https://github.com/vasi/squashfuse/issues/12
51- ./configure --disable-demo --disable-high-level --without-lzo --without-lz4 --with-xz=/usr/lib /
78+ ./configure --disable-demo --disable-high-level --without-lzo --without-lz4 --with-xz=` pwd ` /../xz-5.2.3/build /
5279fi
5380
5481bash --version
@@ -75,7 +102,7 @@ objcopy --add-section .sha256_sig=1024_blank_bytes \
75102
76103# Now statically link against libsquashfuse_ll, libsquashfuse and liblzma
77104# and embed .upd_info and .sha256_sig sections
78- cc ../elf.c ../notify.c ../getsection.c runtime3.o ../squashfuse/.libs/libsquashfuse_ll.a ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -Wl,-Bdynamic -lfuse -lpthread -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -ldl -o runtime
105+ cc ../elf.c ../notify.c ../getsection.c runtime3.o ../squashfuse/.libs/libsquashfuse_ll.a ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -L../xz-5.2.3/build/lib - Wl,-Bdynamic -lfuse -lpthread -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -ldl -o runtime
79106strip runtime
80107
81108# Test if we can read it back
@@ -97,13 +124,12 @@ ld -r -b binary -o data.o runtime
97124
98125# Compile and link digest tool
99126
100- cc -o digest ../getsection.c ../digest.c -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -lz -ldl
101- # cc -o digest -Wl,-Bdynamic ../digest.c -Wl,-Bstatic -static -lcrypto -Wl,-Bdynamic -ldl # 1.4 MB
127+ cc -o digest ../getsection.c ../digest.c -I../openssl-1.1.0c/build/include -L../openssl-1.1.0c/build/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -lz -ldl
102128strip digest
103129
104130# Compile and link validate tool
105131
106- cc -o validate ../getsection.c ../validate.c -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -lglib-2.0 $( pkg-config --cflags glib-2.0) -lz -ldl
132+ cc -o validate ../getsection.c ../validate.c -I../openssl-1.1.0c/build/include -L../openssl-1.1.0c/build/lib - Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -lglib-2.0 $( pkg-config --cflags glib-2.0) -lz -ldl
107133strip validate
108134
109135# Test if we can read it back
@@ -121,11 +147,11 @@ ld -r -b binary -o data.o runtime
121147
122148# Compile appimagetool but do not link - glib version
123149
124- cc -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" -D_FILE_OFFSET_BITS=64 -I../squashfuse/ $( pkg-config --cflags glib-2.0) -I/usr/lib/x86_64-linux-gnu/glib-2.0/include - g -Os ../getsection.c -c ../appimagetool.c
150+ cc -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" -D_FILE_OFFSET_BITS=64 -I../squashfuse/ $( pkg-config --cflags glib-2.0) -g -Os ../getsection.c -c ../appimagetool.c
125151
126152# Now statically link against libsquashfuse and liblzma - glib version
127153
128- cc data.o appimagetool.o ../elf.c ../getsection.c -DENABLE_BINRELOC ../binreloc.c ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -Wl,-Bdynamic -lfuse -lpthread -lglib-2.0 $( pkg-config --cflags glib-2.0) -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -o appimagetool # liblz4
154+ cc data.o appimagetool.o ../elf.c ../getsection.c -DENABLE_BINRELOC ../binreloc.c ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -L../xz-5.2.3/build/lib - Wl,-Bdynamic -lfuse -lpthread -lglib-2.0 $( pkg-config --cflags glib-2.0) -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -o appimagetool # liblz4
129155
130156# Version without glib
131157# cc -D_FILE_OFFSET_BITS=64 -I ../squashfuse -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -Os -c ../appimagetoolnoglib.c
144170rm -f a.out
145171
146172# appimaged, an optional component
147- cc -std=gnu99 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBARCHIVE3=$have_libarchive3 -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" ../getsection.c ../notify.c -Wl,-Bdynamic ../elf.c ../appimaged.c ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -I../squashfuse/ -Wl,-Bstatic -linotifytools -Wl,-Bdynamic -larchive${archive_n} $( pkg-config --cflags --libs glib-2.0) $( pkg-config --cflags --libs gio-2.0) $( pkg-config --libs --cflags cairo) -ldl -lpthread -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -o appimaged # liblz4
173+ cc -std=gnu99 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBARCHIVE3=$have_libarchive3 -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" ../getsection.c ../notify.c -Wl,-Bdynamic ../elf.c ../appimaged.c ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a -I../squashfuse/ -L../xz-5.2.3/build/lib -I../inotify-tools-3.14/build/include -L../inotify-tools-3.14/build/lib - Wl,-Bstatic -linotifytools -Wl,-Bdynamic -larchive${archive_n} $( pkg-config --cflags --libs glib-2.0) $( pkg-config --cflags gio-2.0 ) $( pkg-config --libs gio-2.0) $( pkg-config --libs --cflags cairo) -ldl -lpthread -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -o appimaged # liblz4
148174
149175cd ..
150176
@@ -155,13 +181,13 @@ strip build/* 2>/dev/null
155181chmod a+x build/*
156182ls -lh build/*
157183for FILE in $( ls build/* ) ; do
158- echo " build/ $FILE "
159- ldd " build/ $FILE " || true
184+ echo " $FILE "
185+ ldd " $FILE " || true
160186done
161187
162188bash -ex " $HERE /build-appdirs.sh"
163189
164190ls -lh
165191
166- mkdir -p / out/
167- cp -r build/* ./* .AppDir / out/
192+ mkdir -p out
193+ cp -r build/* ./* .AppDir out/
0 commit comments