Make the debian13 install prefix configurable
Replace the hard-coded /usr/local with a PREFIX build argument (default /usr/local) and add a MULTIARCH argument for the Debian multiarch library directory. The toolchain only searches /usr/local by default, so export PATH, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, LIBRARY_PATH, PKG_CONFIG_PATH, CMAKE_PREFIX_PATH and CMAKE_INSTALL_PREFIX for other prefixes. build.sh passes PREFIX and derives MULTIARCH from uname -m. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8f24cf0e17
commit
f18e95dace
2 files changed
+45
-25
No files matched your search
+40
-23
@@ -21,19 +21,36 @@ RUN sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debi
|
||||
aria2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install prefix of every dependency, and the Debian multiarch directory name (`gcc -dumpmachine`)
|
||||
# its libraries are installed under; build.sh derives the latter from `uname -m`.
|
||||
ARG PREFIX=/usr/local
|
||||
ARG MULTIARCH=x86_64-linux-gnu
|
||||
|
||||
# Make the compiler, CMake, pkg-config and the shell find earlier dependencies under a prefix other
|
||||
# than the default /usr/local. CMake (>= 3.29) takes its default install prefix from the environment.
|
||||
ENV PATH=${PREFIX}/bin:${PATH} \
|
||||
C_INCLUDE_PATH=${PREFIX}/include \
|
||||
CPLUS_INCLUDE_PATH=${PREFIX}/include \
|
||||
LIBRARY_PATH=${PREFIX}/lib/${MULTIARCH}:${PREFIX}/lib \
|
||||
PKG_CONFIG_PATH=${PREFIX}/lib/${MULTIARCH}/pkgconfig:${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig \
|
||||
CMAKE_PREFIX_PATH=${PREFIX} \
|
||||
CMAKE_INSTALL_PREFIX=${PREFIX}
|
||||
|
||||
RUN test "$(cmake --version | sed -n '1s/[^0-9]*//p' | cut -d. -f2)" -ge 29
|
||||
|
||||
RUN git config --global url."https://wangguofang.net/github.com/".insteadOf "https://github.com/"
|
||||
|
||||
RUN --mount=type=bind,from=sources,source=rust,target=/tmp/rust \
|
||||
mkdir rust-src \
|
||||
&& tar -xJf "/tmp/rust/rust-1.99.1-$(uname -m)-unknown-linux-gnu.tar.xz" -C rust-src --strip-components=1 \
|
||||
&& rust-src/install.sh --prefix=/usr/local --without=rust-docs \
|
||||
&& rust-src/install.sh --prefix=${PREFIX} --without=rust-docs \
|
||||
&& rm -rf rust-src
|
||||
|
||||
RUN --mount=type=bind,from=sources,source=boost_1_83_0.tar.bz2,target=/tmp/boost.tar.bz2 \
|
||||
mkdir src \
|
||||
&& tar --extract --bzip2 --file=/tmp/boost.tar.bz2 --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& ./bootstrap.sh --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& ./bootstrap.sh --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
&& ./b2 --jobs="$(nproc)" \
|
||||
--with-atomic \
|
||||
--with-chrono \
|
||||
@@ -59,7 +76,7 @@ RUN --mount=type=bind,from=sources,source=openssl-openssl-3.0.15.tar.gz,target=/
|
||||
mkdir src \
|
||||
&& tar --extract --gzip --file=/tmp/openssl.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& ./Configure --prefix=/usr/local --libdir=lib/$(gcc -dumpmachine) no-shared no-tests -fPIC \
|
||||
&& ./Configure --prefix=${PREFIX} --libdir=lib/$(gcc -dumpmachine) no-shared no-tests -fPIC \
|
||||
&& make --jobs="$(nproc)" \
|
||||
&& make install_sw \
|
||||
&& cd .. \
|
||||
@@ -99,7 +116,7 @@ RUN --mount=type=bind,from=sources,source=zlib-v1.3.1.tar.gz,target=/tmp/zlib.ta
|
||||
mkdir src \
|
||||
&& tar --extract --gzip --file=/tmp/zlib.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) --static \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) --static \
|
||||
&& make --jobs="$(nproc)" \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
@@ -199,7 +216,7 @@ RUN --mount=type=bind,from=sources,source=gflags-v2.3.1.tar.gz,target=/tmp/gflag
|
||||
-DINSTALL_HEADERS=ON \
|
||||
-DINSTALL_SHARED_LIBS=OFF \
|
||||
-DINSTALL_STATIC_LIBS=ON \
|
||||
-DLIBRARY_INSTALL_DIR=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
-DLIBRARY_INSTALL_DIR=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
-DREGISTER_INSTALL_PREFIX=OFF \
|
||||
&& cmake --build build --parallel "$(nproc)" --target install \
|
||||
&& rm -rf build src
|
||||
@@ -223,7 +240,7 @@ RUN --mount=type=bind,from=sources,source=liburing-liburing-2.15.tar.gz,target=/
|
||||
mkdir src \
|
||||
&& tar --extract --gzip --file=/tmp/liburing.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) --libdevdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) --libdevdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
&& make --jobs="$(nproc)" ENABLE_SHARED=0 library \
|
||||
&& make ENABLE_SHARED=0 install \
|
||||
&& cd .. \
|
||||
@@ -233,7 +250,7 @@ RUN --mount=type=bind,from=sources,source=libaio_0.3.113.orig.tar.gz,target=/tmp
|
||||
mkdir src \
|
||||
&& tar --extract --gzip --file=/tmp/libaio.tar.gz --directory=src --strip-components=1 \
|
||||
&& make --directory=src --jobs="$(nproc)" ENABLE_SHARED=0 \
|
||||
&& make --directory=src ENABLE_SHARED=0 prefix=/usr/local libdir=/usr/local/lib/$(gcc -dumpmachine) install \
|
||||
&& make --directory=src ENABLE_SHARED=0 prefix=${PREFIX} libdir=${PREFIX}/lib/$(gcc -dumpmachine) install \
|
||||
&& rm -rf src
|
||||
|
||||
RUN --mount=type=bind,from=sources,source=libdwarf-code-v2.3.2.tar.gz,target=/tmp/libdwarf-code.tar.gz \
|
||||
@@ -257,7 +274,7 @@ RUN --mount=type=bind,from=sources,source=libsodium-1.0.20-RELEASE.tar.gz,target
|
||||
&& tar --extract --gzip --file=/tmp/libsodium.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& ./autogen.sh \
|
||||
&& ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) --disable-shared --enable-static --with-pic \
|
||||
&& ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) --disable-shared --enable-static --with-pic \
|
||||
&& make --jobs="$(nproc)" \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
@@ -293,7 +310,7 @@ RUN --mount=type=bind,from=sources,source=numactl-v2.0.19.tar.gz,target=/tmp/num
|
||||
&& tar --extract --gzip --file=/tmp/numactl.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& ./autogen.sh \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) --disable-shared --enable-static \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) --disable-shared --enable-static \
|
||||
&& make --jobs="$(nproc)" \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
@@ -393,7 +410,7 @@ RUN --mount=type=bind,from=sources,source=util-linux-2.42.2.tar.xz,target=/tmp/u
|
||||
mkdir src \
|
||||
&& tar --extract --xz --file=/tmp/util-linux.tar.xz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
--disable-all-programs \
|
||||
--disable-bash-completion \
|
||||
--disable-makeinstall-chown \
|
||||
@@ -497,7 +514,7 @@ RUN --mount=type=bind,from=sources,source=rapidjson-v1.1.0.tar.gz,target=/tmp/ra
|
||||
&& tar --extract --gzip --file=/tmp/rapidjson.tar.gz --directory=src --strip-components=1 \
|
||||
&& git -C src apply /tmp/rapidjson-generic-string-ref-assignment.patch \
|
||||
&& cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \
|
||||
-DLIB_INSTALL_DIR=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
-DLIB_INSTALL_DIR=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
-DRAPIDJSON_BUILD_DOC=OFF \
|
||||
-DRAPIDJSON_BUILD_EXAMPLES=OFF \
|
||||
-DRAPIDJSON_BUILD_TESTS=OFF \
|
||||
@@ -550,7 +567,7 @@ RUN --mount=type=bind,from=sources,source=gmp-6.3.0.tar.xz,target=/tmp/gmp.tar.x
|
||||
mkdir src \
|
||||
&& tar --extract --xz --file=/tmp/gmp.tar.xz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) --disable-shared --enable-static \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) --disable-shared --enable-static \
|
||||
&& make --jobs="$(nproc)" \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
@@ -560,7 +577,7 @@ RUN --mount=type=bind,from=sources,source=nettle-3.10.2.tar.gz,target=/tmp/nettl
|
||||
mkdir src \
|
||||
&& tar --extract --gzip --file=/tmp/nettle.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
--disable-documentation \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
@@ -573,7 +590,7 @@ RUN --mount=type=bind,from=sources,source=gnutls-3.8.13.tar.xz,target=/tmp/gnutl
|
||||
mkdir src \
|
||||
&& tar --extract --xz --file=/tmp/gnutls.tar.xz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
--with-included-libtasn1 \
|
||||
--with-included-unistring \
|
||||
--disable-cxx \
|
||||
@@ -613,7 +630,7 @@ RUN --mount=type=bind,from=sources,source=libyaml-0.2.5.tar.gz,target=/tmp/libya
|
||||
&& tar --extract --gzip --file=/tmp/libyaml.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& ./bootstrap \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) --disable-shared --enable-static \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) --disable-shared --enable-static \
|
||||
&& make --jobs="$(nproc)" \
|
||||
&& make install \
|
||||
&& cd .. \
|
||||
@@ -653,7 +670,7 @@ RUN --mount=type=bind,from=sources,source=libunwind-v1.8.3.tar.gz,target=/tmp/li
|
||||
&& tar --extract --gzip --file=/tmp/libunwind.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& autoreconf --install \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& CFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
--disable-tests \
|
||||
@@ -670,7 +687,7 @@ RUN --mount=type=bind,from=sources,source=jemalloc-5.3.1.tar.gz,target=/tmp/jema
|
||||
&& tar --extract --gzip --file=/tmp/jemalloc.tar.gz --directory=src --strip-components=1 \
|
||||
&& cd src \
|
||||
&& ./autogen.sh \
|
||||
&& CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
&& CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=${PREFIX} --libdir=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
--disable-doc \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
@@ -685,8 +702,8 @@ RUN --mount=type=bind,from=sources,source=libproxyprotocol-v1.3.3.tar.gz,target=
|
||||
mkdir src \
|
||||
&& tar --extract --gzip --file=/tmp/libproxyprotocol.tar.gz --directory=src --strip-components=1 \
|
||||
&& gcc -fPIC -c -o src/src/proxy_protocol.o src/src/proxy_protocol.c \
|
||||
&& ar rcs /usr/local/lib/$(gcc -dumpmachine)/libproxyprotocol.a src/src/proxy_protocol.o \
|
||||
&& cp src/src/proxy_protocol.h /usr/local/include/ \
|
||||
&& ar rcs ${PREFIX}/lib/$(gcc -dumpmachine)/libproxyprotocol.a src/src/proxy_protocol.o \
|
||||
&& cp src/src/proxy_protocol.h ${PREFIX}/include/ \
|
||||
&& rm -rf src
|
||||
|
||||
RUN --mount=type=bind,from=sources,source=xsimd-14.2.0.tar.gz,target=/tmp/xsimd.tar.gz \
|
||||
@@ -706,10 +723,10 @@ RUN --mount=type=bind,from=sources,source=thrift-v0.22.0.tar.gz,target=/tmp/thri
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_TUTORIALS=OFF \
|
||||
-DCMAKE_INSTALL_DIR=/usr/local/lib/$(gcc -dumpmachine)/cmake \
|
||||
-DCMAKE_INSTALL_DIR=${PREFIX}/lib/$(gcc -dumpmachine)/cmake \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DLIB_INSTALL_DIR=/usr/local/lib/$(gcc -dumpmachine) \
|
||||
-DPKGCONFIG_INSTALL_DIR=/usr/local/lib/$(gcc -dumpmachine)/pkgconfig \
|
||||
-DLIB_INSTALL_DIR=${PREFIX}/lib/$(gcc -dumpmachine) \
|
||||
-DPKGCONFIG_INSTALL_DIR=${PREFIX}/lib/$(gcc -dumpmachine)/pkgconfig \
|
||||
-DWITH_AS3=OFF \
|
||||
-DWITH_C_GLIB=OFF \
|
||||
-DWITH_CPP=ON \
|
||||
@@ -723,7 +740,7 @@ RUN --mount=type=bind,from=sources,source=thrift-v0.22.0.tar.gz,target=/tmp/thri
|
||||
-DWITH_ZLIB=OFF \
|
||||
&& cmake --build build --parallel "$(nproc)" --target install \
|
||||
&& sed -i 's|^libdir=.*|libdir=${prefix}/lib/'"$(gcc -dumpmachine)"'|' \
|
||||
/usr/local/lib/$(gcc -dumpmachine)/pkgconfig/thrift.pc \
|
||||
${PREFIX}/lib/$(gcc -dumpmachine)/pkgconfig/thrift.pc \
|
||||
&& rm -rf build src
|
||||
|
||||
RUN --mount=type=bind,from=sources,source=snappy-1.2.2.tar.gz,target=/tmp/snappy.tar.gz \
|
||||
|
||||
Reference in new issue
Block a user