shrub/nix/nixcrpkgs/macos/strip_builder.sh
benjamin-tlon edd57d380d
Finish cc-release cross-compilation. (#1202)
- Fixes the IPC bug
- Fixes the terminfo bug
- Moves the OSX SDK out of our nixcrpkgs fork.
- Vendor nixcrpkgs instead of having it be a submodule.
2019-04-23 19:50:38 -07:00

44 lines
1.1 KiB
Bash

source $setup
tar -xf $src
mv cctools-port-* cctools-port
cd cctools-port
for patch in $patches; do
echo applying patch $patch
patch -p1 -i $patch
done
# Similar to but not the same as the other _structs.h.
rm cctools/include/foreign/mach/i386/_structs.h
# Causes a troublesome undefined reference.
rm cctools/libstuff/vm_flush_cache.c
cd ..
mv cctools-port/cctools/misc .
mv cctools-port/cctools/include .
mv cctools-port/cctools/libstuff .
rm -r cctools-port
mkdir build
cd build
CFLAGS="-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-result -Werror -Wfatal-errors -O2 -g -I../include -I../include/foreign -DPROGRAM_PREFIX=\\\"$host-\\\" -D__LITTLE_ENDIAN__ -D__private_extern__= -D__DARWIN_UNIX03 -DPACKAGE_NAME=\\\"cctools\\\" -DPACKAGE_VERSION=\\\"$apple_version\\\" -DEMULATED_HOST_CPU_TYPE=16777223 -DEMULATED_HOST_CPU_SUBTYPE=3"
CXXFLAGS="-std=gnu++11 $CFLAGS"
LDFLAGS="-ldl -lpthread"
for f in ../misc/strip.c ../libstuff/*.c; do
echo "compiling $f"
eval "gcc -c $CFLAGS $f -o $(basename $f).o"
done
gcc *.o $LDFLAGS -o $host-strip
mkdir -p $out/bin
cp $host-strip $out/bin/