]> pd.if.org Git - zpackage/commitdiff
use modified musl provide scripts
authorNathan Wagner <nw@hydaspes.if.org>
Mon, 18 Feb 2019 11:05:20 +0000 (11:05 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 18 Feb 2019 11:05:20 +0000 (11:05 +0000)
Static linking wasn't always working with the previous setup.  Musl
provides a musl-clang script if compiled with clang.  This is used with
some small modifications.

Makefile

index 938d33678163b9644b6bc1000cdb92d007e76c0d..244521b911363db9894b467f46d14e1c8846d0ad 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,16 @@
 CC=clang --target=x86_64-pc-linux-musl
 CC=/usr/musl/bin/musl-clang
+LD=lld
 #CC=/usr/musl/bin/musl-gcc
 #CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api --target=x86_64-pc-linux-musl
-CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api
+CFLAGS=-Wall -W -Wextra -Werror -Wno-implicit-fallthrough -std=c99 -Ilib -Isqlite -Ielf -I. -Ilzma/api -Wno-unused-command-line-argument
 
 ZPMVER:=$(shell git describe --tags --match 'v[0-9]*' | sed -e 's/^v//' | sed -e 's/-g.\+//' | sed -e 's/-/./g')
 
 LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4
 
-LDFLAGS=-fuse-ld=lld -L. -static
+#LDFLAGS=-fuse-ld=lld -L. -static
+LDFLAGS=-fuse-ld=/usr/musl/bin/ld.musl-clang -L. -static
 
 LZMACHECKSRC=lzma/check/check.c lzma/check/crc32_fast.c lzma/check/crc64_fast.c lzma/check/crc32_table.c lzma/check/crc64_table.c
 LZMASRC=$(shell ls lzma/lzma/*.c lzma/common/*.c lzma/lz/*.c) $(LZMACHECKSRC) lzma/rangecoder/price_table.c
@@ -182,13 +184,13 @@ newdb.c: db.sql
        echo ", 0};" >> $@
 
 sqlite/sqlite3.o: sqlite/sqlite3.c sqlite/config.h
-       $(CC) -Wall -std=c99 -Ilib -D_HAVE_SQLITE_CONFIG_H=1 -c -o $@ $<
+       $(CC) -Wall -Wno-unused-command-line-argument -std=c99 -Ilib -D_HAVE_SQLITE_CONFIG_H=1 -c -o $@ $<
 
 sqlite/extensions.o: sqlite/extensions.c
        $(CC) -O3 -Wall -std=c99 -I. -Isqlite -DSQLITE_CORE=1 -c -o $@ $<
 
 sqlite/shell.o: sqlite/shell.c sqlite/config.h Makefile
-       $(CC) -Wall -std=c99 -Ilib \
+       $(CC) -Wall -Wno-unused-command-line-argument -std=c99 -Ilib \
                -DSQLITE_OMIT_LOAD_EXTENSION=1 \
                '-DSQLITE_SHELL_INIT_PROC(x)=zpm_setup_extensions(x)' \
                -D_POSIX_C_SOURCE=200112L -c -o $@ $<
@@ -238,7 +240,7 @@ crypto/x25519.o: $(addprefix crypto/ref10/, $(X255OBJ))
        ld -o $@ -r $+
 
 crypto/%.o: CFLAGS+=-Icrypto -DTFM_DESC -DTFM_NO_ASM \
-       -Itomsfastmath/src/headers -static \
+       -Itomsfastmath/src/headers \
        -Wno-pointer-sign -Wno-missing-braces -Ilibtomcrypt/src/headers
 
 #      -DDEBUG
@@ -767,7 +769,7 @@ crypto/rfc3986.c: crypto/rfc3986.re
 rfc3986: rfc3986.c
        $(CC) -Wall -W -Wextra -Werror -o $@ $+
 
-src/fetchurl.o: CFLAGS+=-DTFM_DESC -Isrc/headers -Itomsfastmath/src/headers -DARGTYPE=4 -DLTC_NO_ASM -DTFM_NO_ASM -Ilibtomcrypt/src/headers -DLTC_SOURCE -Icrypto -Wno-pointer-sign -DDEBUG
+src/fetchurl.o: CFLAGS+=-DTFM_DESC -Isrc/headers -Itomsfastmath/src/headers -DARGTYPE=4 -DLTC_NO_ASM -DTFM_NO_ASM -Ilibtomcrypt/src/headers -DLTC_SOURCE -Icrypto -Wno-pointer-sign
 
 zpm-fetchurl: ltc.o tls.o tfm.o src/fetchurl.o crypto/https.o crypto/rfc3986.o
        $(CC) $(CFLAGS) -static -o $@ $+
@@ -779,6 +781,7 @@ testgra: zpm-fetchurl
        ./zpm-fetchurl granicus.if.org 443 /
 
 SIGNSRC= \
+crypto/libeddsa/sign.c \
 crypto/libeddsa/lib/burn.c \
 crypto/libeddsa/lib/burnstack.c \
 crypto/libeddsa/lib/ed.c \
@@ -786,15 +789,15 @@ crypto/libeddsa/lib/ed25519-sha512.c \
 crypto/libeddsa/lib/fld.c \
 crypto/libeddsa/lib/sc.c \
 crypto/libeddsa/lib/sha512.c \
-crypto/libeddsa/lib/x25519.c \
-crypto/libeddsa/sign.c
+crypto/libeddsa/lib/x25519.c
 
 SIGNOBJ=$(SIGNSRC:.c=.o)
 
-$(SIGNOBJ): CFLAGS+=-Icrypto/libeddsa/lib
+$(SIGNOBJ): CFLAGS=-Wall -Wextra -W -Werror -Wno-pointer-sign \
+       -Icrypto/libeddsa/lib -Wno-unused-command-line-argument
 
 zpm-sign: $(SIGNOBJ)
-       $(CC) $(CFLAGS) -static -o $@ $+
+       $(CC) -Wall -Wextra -W -Werror -Wno-unused-command-line-argument -static -o $@ $+
 
 clean:
        rm -f *.o sqlite/*.o lib/*.o $(LZMAOBJ) liblzma.a \
@@ -809,4 +812,5 @@ clean:
                $(addprefix crypto/, $(TLSOBJ)) \
                $(addprefix tomsfastmath/src/, $(TFMOBJ)) \
                $(addprefix libtomcrypt/src/, $(LTCOBJ)) \
+               $(SIGNOBJ) \
                x25519.o