44# and builds AppImage
55#
66
7+ CC=" cc -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result"
8+
79STATIC_BUILD=1
810INSTALL_DEPENDENCIES=1
911
@@ -78,7 +80,7 @@ if [ $STATIC_BUILD -eq 1 ]; then
7880 cd openssl-1.1.0c
7981 mkdir -p build/lib
8082 ./config --prefix=` pwd` /build
81- make && make install
83+ make && make install PROCESS_PODS= ' '
8284 cd -
8385 rm openssl-1.1.0c/build/lib/* .so*
8486 fi
@@ -147,7 +149,7 @@ cp ../squashfs-tools/squashfs-tools/mksquashfs .
147149
148150# Compile runtime but do not link
149151
150- cc -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" -I../squashfuse/ -D_FILE_OFFSET_BITS=64 -g -Os -c ../runtime.c
152+ $CC -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" -I../squashfuse/ -D_FILE_OFFSET_BITS=64 -g -Os -c ../runtime.c
151153
152154# Prepare 1024 bytes of space for updateinformation
153155printf ' \0%.0s' {0..1023} > 1024_blank_bytes
@@ -160,7 +162,9 @@ objcopy --add-section .sha256_sig=1024_blank_bytes \
160162
161163# Now statically link against libsquashfuse_ll, libsquashfuse and liblzma
162164# and embed .upd_info and .sha256_sig sections
163- 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
165+ $CC -o runtime ../elf.c ../notify.c ../getsection.c runtime3.o \
166+ ../squashfuse/.libs/libsquashfuse_ll.a ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a \
167+ -L../xz-5.2.3/build/lib -Wl,-Bdynamic -lfuse -lpthread -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic -ldl
164168strip runtime
165169
166170# Test if we can read it back
@@ -195,15 +199,23 @@ ld -r -b binary -o data.o runtime
195199
196200# Compile appimagetool but do not link - glib version
197201
198- 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
202+ $CC -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" -D_FILE_OFFSET_BITS=64 -I../squashfuse/ \
203+ $( pkg-config --cflags glib-2.0) -g -Os ../getsection.c -c ../appimagetool.c
199204
200205# Now statically link against libsquashfuse - glib version
201206if [ $STATIC_BUILD -eq 1 ]; then
202207 # statically link against liblzma
203- 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
208+ $CC -o appimagetool data.o appimagetool.o ../elf.c ../getsection.c -DENABLE_BINRELOC ../binreloc.c \
209+ ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a \
210+ -L../xz-5.2.3/build/lib \
211+ -Wl,-Bdynamic -lfuse -lpthread \
212+ -Wl,--as-needed $( pkg-config --cflags --libs glib-2.0) -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic
204213else
205214 # dinamically link against distro provided liblzma
206- 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 -llzma -o appimagetool # liblz4
215+ $CC -o appimagetool data.o appimagetool.o ../elf.c ../getsection.c -DENABLE_BINRELOC ../binreloc.c \
216+ ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a \
217+ -Wl,-Bdynamic -lfuse -lpthread \
218+ -Wl,--as-needed $( pkg-config --cflags --libs glib-2.0) -lz -llzma
207219fi
208220
209221# Version without glib
213225# Compile and link digest tool
214226
215227if [ $STATIC_BUILD -eq 1 ]; then
216- 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
228+ $CC -o digest ../getsection.c ../digest.c -I../openssl-1.1.0c/build/include -L../openssl-1.1.0c/build/lib \
229+ -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -lz -ldl
217230else
218- cc -o digest ../getsection.c ../digest.c -Wl,-Bdynamic -lssl -lcrypto -lz -ldl
231+ $CC -o digest ../getsection.c ../digest.c -Wl,-Bdynamic -lssl -lcrypto -lz -ldl
219232fi
220233
221234strip digest
222235
223236# Compile and link validate tool
224237
225238if [ $STATIC_BUILD -eq 1 ]; then
226- 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
239+ $CC -o validate ../getsection.c ../validate.c -I../openssl-1.1.0c/build/include -L../openssl-1.1.0c/build/lib \
240+ -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -Wl,--as-needed $( pkg-config --cflags --libs glib-2.0) -lz -ldl
227241else
228- cc -o validate ../getsection.c ../validate.c -Wl,-Bdynamic -lssl -lcrypto -lglib-2.0 $( pkg-config --cflags glib-2.0) -lz -ldl
242+ $CC -o validate ../getsection.c ../validate.c -Wl,-Bdynamic -lssl -lcrypto \
243+ -Wl,--as-needed $( pkg-config --cflags --libs glib-2.0) -lz -ldl
229244fi
230245
231246strip validate
232247
233248# AppRun
234- cc ../AppRun.c -o AppRun
249+ $CC ../AppRun.c -o AppRun
235250
236251# check for libarchive name
237252have_libarchive3=0
@@ -244,9 +259,26 @@ rm -f a.out
244259
245260# appimaged, an optional component
246261if [ $STATIC_BUILD -eq 1 ]; then
247- 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
262+ $CC -std=gnu99 -o appimaged -I../squashfuse/ ../getsection.c ../notify.c ../elf.c ../appimaged.c \
263+ -D_FILE_OFFSET_BITS=64 -DHAVE_LIBARCHIVE3=$have_libarchive3 -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" \
264+ ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a \
265+ -L../xz-5.2.3/build/lib -I../inotify-tools-3.14/build/include -L../inotify-tools-3.14/build/lib \
266+ -Wl,-Bstatic -linotifytools -Wl,-Bdynamic -larchive${archive_n} \
267+ -Wl,--as-needed \
268+ $( pkg-config --cflags --libs glib-2.0) \
269+ $( pkg-config --cflags --libs gio-2.0) \
270+ $( pkg-config --cflags --libs cairo) \
271+ -ldl -lpthread -lz -Wl,-Bstatic -llzma -Wl,-Bdynamic
248272else
249- 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,-Bdynamic -linotifytools -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 -llzma -o appimaged # liblz4
273+ $CC -std=gnu99 -o appimaged -I../squashfuse/ ../getsection.c ../notify.c ../elf.c ../appimaged.c \
274+ -D_FILE_OFFSET_BITS=64 -DHAVE_LIBARCHIVE3=$have_libarchive3 -DVERSION_NUMBER=\" $( git describe --tags --always --abbrev=7) \" \
275+ ../squashfuse/.libs/libsquashfuse.a ../squashfuse/.libs/libfuseprivate.a \
276+ -Wl,-Bdynamic -linotifytools -larchive${archive_n} \
277+ -Wl,--as-needed \
278+ $( pkg-config --cflags --libs glib-2.0) \
279+ $( pkg-config --cflags --libs gio-2.0) \
280+ $( pkg-config --cflags --libs cairo) \
281+ -ldl -lpthread -lz -llzma
250282fi
251283
252284cd ..
0 commit comments