Skip to content

Commit

Permalink
feat(toolchain): reorganize the layout
Browse files Browse the repository at this point in the history
  • Loading branch information
adonis0147 committed Dec 5, 2024
1 parent be2ab46 commit 56aec7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
13 changes: 7 additions & 6 deletions devel/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,7 @@ function install_python() {
mkdir build
cd build

py_cv_module__dbm='n/a' py_cv_module__gdbm='n/a' py_cv_module__uuid='n/a' \
CFLAGS="-I${DEVEL_HOME_PATH}/include/ncursesw" \
LDFLAGS="-L${DEVEL_HOME_PATH}/lib" \
CFLAGS="-I${DEVEL_HOME_PATH}/include/ncursesw" \
../configure --prefix="${DEVEL_HOME_PATH}/opt/${package}" \
--with-openssl="${DEVEL_HOME_PATH}/opt/openssl" --enable-shared --enable-optimizations
make -j "${NUM_CORES}"
Expand Down Expand Up @@ -759,7 +757,7 @@ EOF
ninja install

rpath="$(find "${DEVEL_HOME_PATH}/opt/${package}/lib" -maxdepth 1 -name "$(uname -m)-*-linux-gnu")"
sed -i "/-Wl,-rpath/ s/\$/:${rpath//\//\\/}/" "${HOME}/.config/${package}/clang.cfg"
sed -i "/-Wl,-rpath/ s|\$|:${rpath}|" "${HOME}/.config/${package}/clang.cfg"
mv "${HOME}/.config/${package}"/* "${DEVEL_HOME_PATH}/opt/${package}/bin/"
popd >/dev/null

Expand Down Expand Up @@ -914,8 +912,11 @@ function main() {
install_toolchain

pushd "${DEVEL_HOME_PATH}" >/dev/null
mkdir -p "compiler/$(uname -m)-linux-gnu/opt"
ln -snf "compiler/$(uname -m)-linux-gnu"/* .
rm -rf "compiler/$(uname -m)-linux-gnu"
ln -snf '..' "compiler/$(uname -m)-linux-gnu"

mkdir lib
ln -snf lib lib64
popd >/dev/null

# Setup locale
Expand Down
20 changes: 1 addition & 19 deletions toolchain/setup_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,6 @@ function configure_toolchain() {
rm -rf "$(pwd)/$(uname -m)-linux-gnu"/*
find "$(pwd)" -name '*.la' -delete

mkdir "$(pwd)/$(uname -m)-linux-gnu/include"
mkdir "$(pwd)/$(uname -m)-linux-gnu/lib"
ln -snf lib "$(pwd)/$(uname -m)-linux-gnu/lib64"

# Link headers
local include_path
include_path="$(pwd)/include/"
pushd "$(uname -m)-linux-gnu/include" >/dev/null || exit
local absolute_path
while read -r absolute_path; do
local path="${absolute_path/${include_path}/}"
if [[ -d "${absolute_path}" ]]; then
mkdir -p "${path}"
else
ln -snf "${absolute_path}" "${path}"
fi
done < <(find "${include_path}" -mindepth 1)
popd >/dev/null || exit

local rpaths=(
"$(pwd)/$(uname -m)-linux-gnu/lib"
"$(dirname "${libc_so}")"
Expand Down Expand Up @@ -207,6 +188,7 @@ export LD_LIBRARY_PATH=\"${library_path}:\${LD_LIBRARY_PATH}\" \\
local dirname
dirname="$(dirname "${interpreter}")"
"$(pwd)/bin/gcc" -dumpspecs | sed "{
/^\*cc1:/ {n; s|\$| -isysroot ${prefix}|}
s|:\([^;}:]*\)/\(${filename/.so*/}\)|:${dirname}/\2|g
s|collect2|collect2 -rpath ${rpaths_in_line}|
}" >"$(pwd)/lib/gcc/specs"
Expand Down

0 comments on commit 56aec7c

Please sign in to comment.