occlum/tools/installer/deb/toolchains/musl-gcc/rules
2024-03-21 16:55:05 +08:00

71 lines
1.7 KiB
Makefile
Executable File

#!/usr/bin/make -f
export DH_VERBOSE = 1
export deb_build_dir = /tmp/deb_build
export name = occlum-toolchains-gcc
export buildroot := $(deb_build_dir)/$(name)/debian/$(name)
export tmp_build_dir = $(deb_build_dir)/$(name)/tmp_build
export install_dir = $(buildroot)/opt/occlum/toolchains/gcc
SHELL = /bin/bash
# Needed by musl-cross-make config
TARGET = x86_64-linux-musl
MUSL_REPO = https://github.com/occlum/musl
MUSL_VER = 1.1.24
GCC_VER = 8.3.0
# Users can pass "-j$(nproc)" by specifying this env.
# This is not enabled by default because under certain scenarios,
# make will use too many jobs and gcc will be killed because out
# of memory.
BUILD_OPTIONS +=
.ONESHELL: prepare_musl override_dh_install
%:
dh $@
# All rules executed in one shell
prepare_musl:
rm -rf $(tmp_build_dir)
rm -rf $(install_dir)
mkdir -p $(src_dir)
mkdir -p $(install_dir)
override_dh_auto_build: prepare_musl
echo "skip override_dh_auto_build"
# We create symlinks in /usr/local
override_dh_usrlocal:
echo "Skip ..."
override_dh_fixperms:
dh_fixperms
# Occlum need this to be executable
chmod 755 $(install_dir)/$(TARGET)/lib/libc.so
override_dh_install:
mkdir -p $(install_dir)
cp -rf /opt/occlum/toolchains/gcc/* $(install_dir)/
mkdir -p $(buildroot)/lib
pushd $(buildroot)/lib
ln -sf /opt/occlum/toolchains/gcc/$(TARGET)/lib/libc.so ld-musl-x86_64.so.1
popd
mkdir -p $(buildroot)/usr/local
pushd $(buildroot)/usr/local
ln -sf /opt/occlum/toolchains/gcc occlum
popd
mkdir -p $(buildroot)/etc/profile.d
cp $(deb_build_dir)/$(name)/debian/occlum-gcc.sh $(buildroot)/etc/profile.d
chmod 644 $(buildroot)/etc/profile.d/occlum-gcc.sh
clean:
dh_clean
rm -f $(buildroot)
override_dh_shlibdeps:
echo "skip ..."