]> git.cameronkatri.com Git - apple_cmds.git/blobdiff - create_tarballs.sh
file_cmds: Fix compilation for lower targets
[apple_cmds.git] / create_tarballs.sh
index 25df18780e65b3604802682ccbed5e688cfe08aa..b14d267477f35989b119c04bbd6c5be84315675d 100755 (executable)
@@ -1,4 +1,13 @@
 #!/bin/sh
+if command -v bsdtar >/dev/null 2>&1; then
+       TAR="bsdtar"
+elif ! tar --version | grep "GNU" >/dev/null 2>&1; then
+       TAR="tar"
+else
+       echo "Install BSD tar"
+       exit 1
+fi
+
 num=0
 for i in adv_cmds basic_cmds bootstrap_cmds \
                developer_cmds diskdev_cmds doc_cmds \
@@ -6,11 +15,19 @@ for i in adv_cmds basic_cmds bootstrap_cmds \
                patch_cmds remote_cmds shell_cmds \
                system_cmds text_cmds; do
        EXTRA_PATHS=""
+       VERSION="$(cat ${i}/.apple_version)"
+       REGEX="|^${i}|${i}-${VERSION}|"
        case "$i" in
-               network_cmds) EXTRA_PATHS="lib/libpcap";;
-               remote_cmds) EXTRA_PATHS="lib/libtelnet";;
+               network_cmds) REGEX="|^|network_cmds-${VERSION}/|" EXTRA_PATHS="lib/libpcap";;
+               remote_cmds) REGEX="|^|remote_cmds-${VERSION}/|" EXTRA_PATHS="lib/libtelnet";;
        esac
        num=$((num+1))
        printf "(%i) %s\n" "$num" "$i"
-       tar caf $i.tar.zst $i ${EXTRA_PATHS}
+       cp setup.sh $i/setup.sh
+       cp $i/Makefile.inc $i.Makefile.inc
+       sed -i '' -e /\.\.\\/Makefile\.inc/d $i/Makefile.inc
+       cat Makefile.inc >> $i/Makefile.inc
+       ${TAR} -s ${REGEX} -caf ${i}-${VERSION}.tar.zst $i ${EXTRA_PATHS}
+       mv $i.Makefile.inc $i/Makefile.inc
+       rm $i/setup.sh
 done