repo/extra/mold/build

27 lines
826 B
Plaintext
Raw Normal View History

#!/bin/sh -e
make -C xxhash
# Point mold to the local xxhash.
export CXXFLAGS="-L$PWD/xxhash -I$PWD/xxhash $CXXFLAGS"
2021-08-15 06:46:11 -06:00
# CMAKE_GENERATOR must unset to force usage of Makefiles. The build system
# calls cmake and proceeds to assume that Makefiles will be used with it
# breaking builds with Ninja/Samurai.
unset CMAKE_GENERATOR
2021-08-15 06:46:11 -06:00
# Force a static build so shared library breakage does not also break the
# linker (and therefore the ability to recover from the issue).
export LDFLAGS="$LDFLAGS -static"
make
make install
# Create a symbolic link so users can use mold as the linker system-wide
# (without need for special CFLAGS/CXXFLAGS).
ln -s mold "$1/usr/bin/ld"
# To tell GCC to use mold we must put a symlink to it in a directory and set it
# to search for the linker within.
ln -s ../../bin/mold "$1/usr/lib/mold/ld"