Skip to content

Commit 47a2b72

Browse files
authored
1 parent f454e54 commit 47a2b72

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- lc3
1616
- misc
1717
- nasm
18+
- python
1819
- pythran
1920
- rocm
2021
- rust-cg-gcc

Dockerfile.python

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:20.04
2+
3+
# Enable source repositories so we can use `apt build-dep` to get all the
4+
# build dependencies for Python 3.5+.
5+
RUN sed -i -- 's/#deb-src/deb-src/g' /etc/apt/sources.list && \
6+
sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list
7+
8+
ARG DEBIAN_FRONTEND=noninteractive
9+
RUN apt update -y -q && apt upgrade -y -q && apt update -y -q && \
10+
apt -q build-dep -y python3.8 && \
11+
apt -q install -y \
12+
curl \
13+
git \
14+
libssl-dev \
15+
unzip \
16+
xz-utils
17+
18+
RUN mkdir -p /root
19+
COPY python /root/
20+
COPY common.sh /root/
21+
22+
WORKDIR /root

python/build.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
set -exu
4+
source common.sh
5+
6+
ROOT=$(pwd)
7+
VERSION=$1
8+
FULLNAME=python-${VERSION}
9+
OUTPUT=${ROOT}/${FULLNAME}.tar.xz
10+
LAST_REVISION="${3:-}"
11+
12+
if [[ -d "${2}" ]]; then
13+
OUTPUT=$2/${FULLNAME}.tar.xz
14+
else
15+
OUTPUT=${2-$OUTPUT}
16+
fi
17+
18+
REVISION="python-${VERSION}"
19+
initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}"
20+
21+
DEST=/root/built
22+
23+
curl -sL https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz | tar zxf -
24+
pushd Python-${VERSION}
25+
./configure \
26+
--prefix=${DEST} \
27+
--enable-optimizations \
28+
--without-pymalloc
29+
30+
make -j$(nproc)
31+
make install
32+
popd
33+
34+
# strip executables
35+
find ${DEST} -type f -perm /u+x -exec strip -d {} \;
36+
37+
# delete tests and static libraries to save disk space
38+
find ${DEST} -type d -name test -exec rm -rf {} +
39+
find ${DEST} -type f -name *.a -delete
40+
41+
complete "${DEST}" "${FULLNAME}" "${OUTPUT}"

0 commit comments

Comments
 (0)