Skip to content

[manylinux2014] Split sqlite3 build in build_cpython image #972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2021
Merged
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: 6 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ RUN export CMAKE_VERSION=3.18.3 && \


FROM build_base AS build_cpython
COPY build_scripts/build-sqlite3.sh /build_scripts/
RUN export SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3340000 && \
export SQLITE_AUTOCONF_HASH=bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee && \
export SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2020 && \
manylinux-entrypoint /build_scripts/build-sqlite3.sh

COPY build_scripts/*pubkey*.txt /build_scripts/
COPY build_scripts/build_env.sh /build_scripts/
COPY build_scripts/build-cpython.sh /build_scripts/
Expand Down
20 changes: 0 additions & 20 deletions docker/build_scripts/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,6 @@ source $MY_DIR/build_env.sh
# Get build utilities
source $MY_DIR/build_utils.sh

# Install a more recent SQLite3
curl -fsSLO $SQLITE_AUTOCONF_DOWNLOAD_URL/$SQLITE_AUTOCONF_ROOT.tar.gz
check_sha256sum $SQLITE_AUTOCONF_ROOT.tar.gz $SQLITE_AUTOCONF_HASH
tar xfz $SQLITE_AUTOCONF_ROOT.tar.gz
cd $SQLITE_AUTOCONF_ROOT
DESTDIR=/sqlite3 do_standard_install
cd ..
rm -rf $SQLITE_AUTOCONF_ROOT*
rm /sqlite3/usr/local/lib/libsqlite3.a
# Install for build
cp -rf /sqlite3/* /
# Clean-up for runtime
rm -rf /sqlite3/usr/local/bin /sqlite3/usr/local/include /sqlite3/usr/local/lib/pkg-config /sqlite3/usr/local/share
# Install for runtime
mkdir -p /manylinux-rootfs
cp -rf /sqlite3/* /manylinux-rootfs/
# clean-up
rm -rf /sqlite3


# Compile the latest Python releases.
# (In order to have a proper SSL module, Python is compiled
# against a recent openssl [see env vars above], which is linked
Expand Down
36 changes: 36 additions & 0 deletions docker/build_scripts/build-sqlite3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Top-level build script called from Dockerfile

# Stop at any error, show all commands
set -exuo pipefail

# Get script directory
MY_DIR=$(dirname "${BASH_SOURCE[0]}")

# Get build utilities
source $MY_DIR/build_utils.sh

# Install a more recent SQLite3
check_var ${SQLITE_AUTOCONF_ROOT}
check_var ${SQLITE_AUTOCONF_HASH}
check_var ${SQLITE_AUTOCONF_DOWNLOAD_URL}
fetch_source ${SQLITE_AUTOCONF_ROOT}.tar.gz ${SQLITE_AUTOCONF_DOWNLOAD_URL}
check_sha256sum ${SQLITE_AUTOCONF_ROOT}.tar.gz ${SQLITE_AUTOCONF_HASH}
tar xfz ${SQLITE_AUTOCONF_ROOT}.tar.gz
pushd ${SQLITE_AUTOCONF_ROOT}
DESTDIR=/manylinux-rootfs do_standard_install
popd
rm -rf ${SQLITE_AUTOCONF_ROOT} ${SQLITE_AUTOCONF_ROOT}.tar.gz

# static library is unused, remove it
rm /manylinux-rootfs/usr/local/lib/libsqlite3.a

# Strip what we can
strip_ /manylinux-rootfs

# Install
cp -rf /manylinux-rootfs/* /

# Clean-up for runtime
rm -rf /manylinux-rootfs/usr/local/bin /manylinux-rootfs/usr/local/include /manylinux-rootfs/usr/local/lib/pkg-config /manylinux-rootfs/usr/local/share
find -L /manylinux-rootfs -type f -a -not -name 'libsqlite3.so.*' -delete
4 changes: 0 additions & 4 deletions docker/build_scripts/build_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python
# of the form <maj>.<min>.<rev> or <maj>.<min>.<rev>rc<n>
CPYTHON_VERSIONS="3.5.10 3.6.12 3.7.9 3.8.7 3.9.1"

SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3340000
SQLITE_AUTOCONF_HASH=bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee
SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2020