Skip to content

Commit 127b8b9

Browse files
committed
fix: hide libsqlite3.so from system search folders
1 parent 87542c8 commit 127b8b9

File tree

4 files changed

+18
-23
lines changed

4 files changed

+18
-23
lines changed

docker/build_scripts/build-cpython.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ elif [ "${BASE_POLICY}_${AUDITWHEEL_ARCH}" == "musllinux_armv7l" ]; then
5454
CONFIGURE_ARGS+=(--build=arm-linux-musleabihf)
5555
fi
5656

57-
SQLITE_PREFIX=$(find /opt/_internal -maxdepth 1 -name 'sqlite*')
58-
if [ "${SQLITE_PREFIX}" != "" ]; then
59-
case "${CPYTHON_VERSION}" in
60-
3.8.*|3.9.*|3.10.*) sed -i "s|/usr/local/include/sqlite3|/opt/_internal/sqlite3/include|g ; s|sqlite_extra_link_args = ()|sqlite_extra_link_args = ('-Wl,--enable-new-dtags,-rpath=/opt/_internal/sqlite3/lib',)|g" setup.py;;
61-
*) ;;
62-
esac
63-
fi
57+
case "${CPYTHON_VERSION}" in
58+
3.8.*|3.9.*|3.10.*) sed -i "s|/usr/local/include/sqlite3|/opt/_internal/sqlite3/include|g ; s|sqlite_extra_link_args = ()|sqlite_extra_link_args = ('-Wl,--enable-new-dtags,-rpath=/opt/_internal/sqlite3/lib',)|g" setup.py;;
59+
*) ;;
60+
esac
6461

6562
OPENSSL_PREFIX=$(find /opt/_internal -maxdepth 1 -name 'openssl*')
6663
if [ "${OPENSSL_PREFIX}" != "" ]; then

docker/build_scripts/build-sqlite3.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ MY_DIR=$(dirname "${BASH_SOURCE[0]}")
1111
# shellcheck source-path=SCRIPTDIR
1212
source "${MY_DIR}/build_utils.sh"
1313

14-
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_2" ]; then
15-
PREFIX=/usr/local
16-
else
17-
PREFIX=/opt/_internal/sqlite3
18-
fi
14+
PREFIX=/opt/_internal/sqlite3
1915

2016
# Install a more recent SQLite3
2117
check_var "${SQLITE_AUTOCONF_ROOT}"
@@ -42,8 +38,12 @@ strip_ /manylinux-rootfs
4238
mkdir /manylinux-buildfs
4339
cp -rlf /manylinux-rootfs/* /manylinux-buildfs/
4440

45-
if [ "${PREFIX}" == "/opt/_internal/sqlite3" ]; then
46-
# python >= 3.11
47-
mkdir -p /manylinux-buildfs/usr/local/lib/pkgconfig/
48-
ln -s ${PREFIX}/lib/pkgconfig/sqlite3.pc /manylinux-buildfs/usr/local/lib/pkgconfig/sqlite3.pc
41+
# python >= 3.11
42+
mkdir -p /manylinux-buildfs/usr/local/lib/pkgconfig/
43+
ln -s ${PREFIX}/lib/pkgconfig/sqlite3.pc /manylinux-buildfs/usr/local/lib/pkgconfig/sqlite3.pc
44+
45+
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_2" ]; then
46+
# we still expose our custom libsqlite3 for dev in runtime images
47+
mkdir -p /manylinux-rootfs/usr/local/lib/pkgconfig/
48+
ln -s ${PREFIX}/lib/pkgconfig/sqlite3.pc /manylinux-rootfs/usr/local/lib/pkgconfig/sqlite3.pc
4949
fi

docker/tests/ctest/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
cmake_minimum_required(VERSION 3.14.7)
1+
cmake_minimum_required(VERSION 4.0)
22
project(manylinux_ctest)
33
include(CTest)
44

55
# SQLite3 test Derived from CMake unit test for FindSQLite3
66
# https://gitlab.kitware.com/cmake/cmake/-/tree/master/Tests/FindSQLite3/Test
7-
find_package(SQLite3 3.34 REQUIRED)
7+
find_package(SQLite3 3.50 REQUIRED)
88
add_definitions(-DCMAKE_EXPECTED_SQLite3_VERSION="${SQLite3_VERSION}")
99
add_executable(test_sqlite3 test_sqlite3.cpp)
1010
target_link_libraries(test_sqlite3 SQLite::SQLite3)

docker/tests/run_tests.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ for PYTHON in /opt/python/*/bin/python; do
6262
if [ "${IMPLEMENTATION}" == "cpython" ]; then
6363
# Make sure sqlite3 module can be loaded properly and is the manylinux version one
6464
# c.f. https://github.com/pypa/manylinux/issues/1030
65-
$PYTHON -c 'import sqlite3; print(sqlite3.sqlite_version); assert sqlite3.sqlite_version_info[0:2] >= (3, 31)'
65+
$PYTHON -c 'import sqlite3; print(sqlite3.sqlite_version); assert sqlite3.sqlite_version_info[0:2] >= (3, 50)'
6666
# Make sure tkinter module can be loaded properly
6767
$PYTHON -c 'import tkinter; print(tkinter.TkVersion); assert tkinter.TkVersion >= 8.6'
6868
# cpython shall be available as python
@@ -128,10 +128,6 @@ pipx run nox --version
128128
pipx install --pip-args='--no-input' nox
129129
nox --version
130130
tar --version | grep "GNU tar"
131-
# we stopped installing sqlite3 after manylinux_2_28 / musllinux_1_2
132-
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_2" ]; then
133-
sqlite3 --version
134-
fi
135131

136132
# check libcrypt.so.1 can be loaded by some system packages,
137133
# as LD_LIBRARY_PATH might not be enough.
@@ -143,6 +139,8 @@ if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ]; then
143139
fi
144140

145141
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] || [ "${AUDITWHEEL_POLICY}" == "manylinux_2_28" ] || [ "${AUDITWHEEL_POLICY}" == "musllinux_1_2" ]; then
142+
# we stopped installing sqlite3 after manylinux_2_28 / musllinux_1_2 & this is becoming an internal detail
143+
/opt/_internal/sqlite3/bin/sqlite3 --version
146144
# sqlite compilation tests, intended to ensure appropriate headers, pkg_config, etc.
147145
# are available for downstream compile against installed tools
148146
source_dir="${MY_DIR}/ctest"

0 commit comments

Comments
 (0)