Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions cpython-unix/build-libxcb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ export PKG_CONFIG_PATH=/tools/deps/share/pkgconfig:/tools/deps/lib/pkgconfig
tar -xf "libxcb-${LIBXCB_VERSION}.tar.gz"
pushd "libxcb-${LIBXCB_VERSION}"

if [[ "${TARGET_TRIPLE}" = loongarch64* ]]; then
rm -f build-aux/config.guess build-aux/config.sub
curl -sSL -o build-aux/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess'
curl -sSL -o build-aux/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub'
fi

if [ "${CC}" = "musl-clang" ]; then
EXTRA_FLAGS="--disable-shared"
fi
Expand Down
6 changes: 0 additions & 6 deletions cpython-unix/build-xorgproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ export PKG_CONFIG_PATH=/tools/deps/share/pkgconfig
tar -xf "xorgproto-${XORGPROTO_VERSION}.tar.gz"
pushd "xorgproto-${XORGPROTO_VERSION}"

if [[ "${TARGET_TRIPLE}" = loongarch64* ]]; then
rm -f config.guess.sub config.sub
curl -sSL -o config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess'
curl -sSL -o config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub'
fi

CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" LDFLAGS="${EXTRA_TARGET_LDFLAGS}" ./configure \
--build="${BUILD_TRIPLE}" \
--host="${TARGET_TRIPLE}" \
Expand Down
18 changes: 12 additions & 6 deletions cpython-unix/build.cross-loongarch64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,20 @@ RUN apt-get install \
zip \
zlib1g-dev

# Clang and lld use the Debian glibc sysroot and GCC startup/runtime objects.
RUN apt-get install \
g++-loongarch64-linux-gnu \
gcc-loongarch64-linux-gnu \
libc6-dev-loong64-cross
libc6-dev-loong64-cross \
libgcc-14-dev-loong64-cross \
linux-libc-dev-loong64-cross

RUN cd /tmp && \
curl -LO https://snapshot.debian.org/archive/debian-ports/20240812T192057Z/pool-loong64/main/libx/libxcrypt/libcrypt-dev_4.4.36-4_loong64.deb && \
curl -LO https://snapshot.debian.org/archive/debian-ports/20240812T192057Z/pool-loong64/main/libx/libxcrypt/libcrypt1_4.4.36-4_loong64.deb && \
dpkg -x libcrypt-dev_4.4.36-4_loong64.deb / && \
dpkg -x libcrypt1_4.4.36-4_loong64.deb / && \
rm -f /tmp/*.deb
dpkg -x libcrypt-dev_4.4.36-4_loong64.deb /tmp/crypt && \
dpkg -x libcrypt1_4.4.36-4_loong64.deb /tmp/crypt && \
cp -a /tmp/crypt/usr/lib/loongarch64-linux-gnu/. /usr/loongarch64-linux-gnu/lib/ && \
cp -a /tmp/crypt/usr/include/. /usr/loongarch64-linux-gnu/include/ && \
rm -rf /tmp/crypt /tmp/*.deb

# Rewrite libc's lib and lib64 paths to be relative to the sysroot for LLD.
RUN sed -i 's@/usr/loongarch64-linux-gnu/@/@g' /usr/loongarch64-linux-gnu/lib/libc.so
18 changes: 14 additions & 4 deletions cpython-unix/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,26 @@ loongarch64-unknown-linux-gnu:
- '3.15'
- '3.16'
docker_image_suffix: .cross-loongarch64
host_cc: /usr/bin/x86_64-linux-gnu-gcc
host_cxx: /usr/bin/x86_64-linux-gnu-g++
target_cc: /usr/bin/loongarch64-linux-gnu-gcc
target_cxx: /usr/bin/loongarch64-linux-gnu-g++
needs_toolchain: true
host_cc: clang
host_cxx: clang++
target_cc: clang
target_cxx: clang++
target_cflags:
- '--target=loongarch64-unknown-linux-gnu'
- '--sysroot=/usr/loongarch64-linux-gnu'
- '--gcc-install-dir=/usr/lib/gcc-cross/loongarch64-linux-gnu/14'
- '-fuse-ld=lld'
- '-Wno-unused-command-line-argument'
# Hardening
- '-fstack-protector'
- '-U_FORTIFY_SOURCE'
- '-D_FORTIFY_SOURCE=2'
target_ldflags:
- '--target=loongarch64-unknown-linux-gnu'
- '--sysroot=/usr/loongarch64-linux-gnu'
- '--gcc-install-dir=/usr/lib/gcc-cross/loongarch64-linux-gnu/14'
- '-fuse-ld=lld'
# Hardening
- '-Wl,-z,noexecstack'
- '-Wl,-z,relro'
Expand Down
Loading