2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-07-02 22:12:27 +00:00
repo/extra/mold/build

27 lines
768 B
Plaintext
Raw Normal View History

#!/bin/sh -e
2023-03-02 14:40:00 +00:00
export DESTDIR="$1"
2021-08-15 12:46:11 +00: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 13:29:28 +00:00
# XXX: Static linking prevents mold from using dlopen() which is required
# for performing LTO.
# export LDFLAGS="$LDFLAGS -static"
2021-08-15 12:46:11 +00:00
2023-07-27 00:37:30 +00:00
patch -p1 < amd64_only.patch
2022-09-27 17:10:15 +00:00
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib
cmake --build build
cmake --install build
# 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"