build-hfsplus.sh (1358B)
1 #!/bin/bash 2 3 # hfsplus needs to be rebuilt when changing the clang version used to build it. 4 # Until bug 1471905 is addressed, increase the following number 5 # when that happens: 1 6 7 set -e 8 set -x 9 10 hfplus_version=540.1.linux3 11 dirname=diskdev_cmds-${hfplus_version} 12 make_flags="-j$(nproc)" 13 14 root_dir="$1" 15 if [ -z "$root_dir" -o ! -d "$root_dir" ]; then 16 root_dir=$(mktemp -d) 17 fi 18 cd $root_dir 19 20 if test -z $TMPDIR; then 21 TMPDIR=/tmp/ 22 fi 23 24 # Build 25 cd $dirname 26 # We want to statically link against libcrypto. On CentOS, that requires zlib 27 # and libdl, because of FIPS functions pulling in more than necessary from 28 # libcrypto (only SHA1 functions are used), but not on Debian, thus 29 # --as-needed. 30 patch -p1 << 'EOF' 31 --- a/newfs_hfs.tproj/Makefile.lnx 32 +++ b/newfs_hfs.tproj/Makefile.lnx 33 @@ -6,3 +6,3 @@ 34 newfs_hfs: $(OFILES) 35 - ${CC} ${CFLAGS} ${LDFLAGS} -o newfs_hfs ${OFILES} -lcrypto 36 + ${CC} ${CFLAGS} ${LDFLAGS} -o newfs_hfs ${OFILES} -Wl,-Bstatic -lcrypto -Wl,-Bdynamic,--as-needed,-lz,-ldl 37 38 EOF 39 grep -rl sysctl.h . | xargs sed -i /sysctl.h/d 40 make $make_flags || exit 1 41 cd .. 42 43 mkdir hfsplus 44 cp $dirname/newfs_hfs.tproj/newfs_hfs hfsplus/newfs_hfs 45 ## XXX fsck_hfs is unused, but is small and built from the package. 46 cp $dirname/fsck_hfs.tproj/fsck_hfs hfsplus/fsck_hfs 47 48 # Make a package of the built utils 49 cd $root_dir 50 tar caf $root_dir/hfsplus.tar.zst hfsplus