#!/bin/sh -e # # This build system is a little funky. I want to contribute upstream to get the # whole thing buildable with Makefiles (no Cmake). make -C xxhash # Point mold to the local xxhash. export CXXFLAGS="-L$PWD/xxhash -I$PWD/xxhash $CXXFLAGS" # Prevent the build system from overwriting CC/CXX. sed /clang/d Makefile > _ mv -f _ Makefile # CMAKE_GENERATOR must be set to force usage of Makefiles. The build system # calls cmake and proceeds to assume that Makefiles will be used with it. make CMAKE_GENERATOR= LDFLAGS="$LDFLAGS -static" 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"