-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
171 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
|
||
ARG UBUNTU=22.04 | ||
ARG ARCH=invalid-arch | ||
ARG VERSION=invalid-version | ||
|
||
FROM wpilib/${ARCH}-cross-ubuntu-minimal:${VERSION}-${UBUNTU} AS pycompile | ||
|
||
ARG TARGET_HOST=invalid-target-host | ||
ARG AC_TARGET_HOST=invalid-ac-target-host | ||
|
||
ENV TARGET_HOST=${TARGET_HOST} | ||
ENV AC_TARGET_HOST=${AC_TARGET_HOST} | ||
ENV BUILD_HOST="x86_64" | ||
ENV WORKING_DIRECTORY="/build" | ||
ENV INSTALL_DIRECTORY="/build/crosspy" | ||
ENV PYTHON_VERSION="3.13.0" | ||
ENV PYTHON_FTP_VERSION="3.13.0" | ||
ENV PYTHON_EXE="python3.13" | ||
ENV SOURCE_DIRECTORY="Python-$PYTHON_VERSION" | ||
ENV PYTHON_ARCHIVE="Python-$PYTHON_VERSION.tar.xz" | ||
ENV PREFIX="$INSTALL_DIRECTORY" | ||
|
||
# | ||
# Python compilation prereqs | ||
# | ||
|
||
RUN set -xe; \ | ||
apt-get update; \ | ||
apt-get install -y build-essential checkinstall g++ libreadline-dev libncursesw5-dev libssl-dev \ | ||
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev liblzma-dev lzma-dev libffi-dev zlib1g-dev; \ | ||
# cleanup | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# | ||
# Python cross-compilation | ||
# | ||
|
||
RUN set -xe; \ | ||
mkdir -p "$PREFIX"; \ | ||
# Download | ||
cd $WORKING_DIRECTORY; \ | ||
wget -c https://www.python.org/ftp/python/$PYTHON_FTP_VERSION/$PYTHON_ARCHIVE; \ | ||
rm -rf $SOURCE_DIRECTORY; \ | ||
tar -xf $PYTHON_ARCHIVE; \ | ||
cd $SOURCE_DIRECTORY; \ | ||
# Build python for host | ||
cd $WORKING_DIRECTORY;cd $SOURCE_DIRECTORY; \ | ||
./configure --enable-optimizations --with-ensurepip=install; \ | ||
make -j; \ | ||
make -j altinstall | ||
|
||
RUN set -xe; \ | ||
# Remove build dependencies -- compilation uses host for some reason | ||
apt-get remove -y libreadline-dev libncursesw5-dev libssl-dev \ | ||
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev liblzma-dev lzma-dev libffi-dev zlib1g-dev; \ | ||
apt-get autoremove -y; | ||
|
||
RUN set -xe; \ | ||
# cross-compile | ||
cd $WORKING_DIRECTORY;cd $SOURCE_DIRECTORY; make distclean; \ | ||
./configure --host=$TARGET_HOST --build=$BUILD_HOST --prefix=$PREFIX \ | ||
--with-build-python=$(which $PYTHON_EXE) \ | ||
--disable-ipv6 \ | ||
ac_cv_host=$AC_TARGET_HOST \ | ||
ac_cv_buggy_getaddrinfo=no \ | ||
ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no \ | ||
ac_cv_have_long_long_format=yes \ | ||
ac_cv_pthread_is_default=no ac_cv_pthread=yes ac_cv_cxx_thread=yes; \ | ||
make -j; \ | ||
# make install here is fine because we include --prefix in the configure statement | ||
make install | ||
|
||
|
||
# | ||
# Minimal cross-compilation environment | ||
# | ||
|
||
FROM wpilib/${ARCH}-cross-ubuntu-minimal:${VERSION}-${UBUNTU} AS crossenv | ||
|
||
RUN set -xe; \ | ||
apt-get update; \ | ||
apt-get install -y \ | ||
binutils libreadline8 libncursesw5 libssl3 \ | ||
libsqlite3-0 libgdbm6 libbz2-1.0 liblzma5 libffi7 zlib1g; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=pycompile /usr/local /usr/local | ||
COPY --from=pycompile /build/crosspy /build/crosspy | ||
|
||
ARG ARCH=invalid-arch | ||
ARG TARGET_HOST=invalid-target-host | ||
ARG MACHINE_ARG= | ||
|
||
RUN set -xe; \ | ||
ldconfig; \ | ||
python3.13 -m pip install 'crossenv~=1.5.0'; \ | ||
python3.13 -m crossenv /build/crosspy/bin/python3.13 /build/venv ${MACHINE_ARG} --sysroot=$(${TARGET_HOST}-gcc -print-sysroot) --env UNIXCONFDIR=/build/venv/cross/etc; \ | ||
/build/venv/bin/cross-pip install wheel; | ||
|
||
COPY pip-${ARCH}.conf /build/venv/cross/pip.conf | ||
COPY os-release-${ARCH} /build/venv/cross/etc/os-release | ||
|
||
ENV RPYBUILD_PARALLEL=1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ID="nilrt-academic" | ||
NAME="NI Linux Real-Time - Academic" | ||
VERSION="8.14" | ||
VERSION_ID="8.14" | ||
PRETTY_NAME="NI Linux Real-Time - Academic 8.14" | ||
VERSION="8.15" | ||
VERSION_ID="8.15" | ||
PRETTY_NAME="NI Linux Real-Time - Academic 8.15" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
[global] | ||
extra-index-url = https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2024/simple | ||
extra-index-url = https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2025/simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
[global] | ||
extra-index-url = | ||
https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2024/simple | ||
https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2025/simple | ||
https://www.piwheels.org/simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
[global] | ||
extra-index-url = https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2024/simple | ||
extra-index-url = https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2025/simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters