2021-08-14 23:26:16 -06:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
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).
|
2022-03-06 06:29:28 -07:00
|
|
|
# XXX: Static linking prevents mold from using dlopen() which is required
|
|
|
|
# for performing LTO.
|
|
|
|
# export LDFLAGS="$LDFLAGS -static"
|
2021-08-15 06:46:11 -06:00
|
|
|
|
|
|
|
make
|
2022-03-06 06:29:28 -07:00
|
|
|
make PREFIX=/usr install
|
2021-08-14 23:26:16 -06:00
|
|
|
|
|
|
|
# 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"
|