diff --git a/AGENTS.md b/AGENTS.md index c2621ff..ac8f23a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,6 +18,7 @@ - System `-dev` packages are allowed only for foundational platform infrastructure, such as glibc and Linux kernel headers. - Document any new foundational `-dev` package exception in this file before adding it to the image. - On Rocky Linux 9, `glibc-devel`, `kernel-headers`, and `libstdc++-devel` may be installed directly or as compiler dependencies because they are foundational C/C++ platform and toolchain components. +- On Alpine Linux, `musl-dev` and `linux-headers` may be installed directly or as compiler dependencies because they are foundational C/C++ platform and toolchain components. ## Meta Libraries diff --git a/README.md b/README.md index a8a92a5..483b380 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Source Stack Build Environments -Debian 13 and Rocky Linux 9 container build environments with a C/C++ toolchain, CMake, and Git preinstalled, compatible with both Docker and Podman. GitHub HTTPS URLs are routed through `gh-proxy.com`. For the libraries included in the images, their pinned versions, and build details, see [INCLUDED_LIBRARIES.md](INCLUDED_LIBRARIES.md). +Debian 13, Rocky Linux 9, and Alpine Linux container build environments with a C/C++ toolchain, CMake, and Git preinstalled, compatible with both Docker and Podman. The Alpine image builds the stack against musl libc. GitHub HTTPS URLs are routed through `gh-proxy.com`. For the libraries included in the images, their pinned versions, and build details, see [INCLUDED_LIBRARIES.md](INCLUDED_LIBRARIES.md). ## Build @@ -10,6 +10,7 @@ Each build script automatically selects Docker or Podman: ./build-all.sh ./debian13/build.sh ./rockylinux9/build.sh +./alpine3.24/build.sh ``` Use environment variables to select the container engine or override image names: @@ -23,4 +24,5 @@ CONTAINER_ENGINE=podman IMAGE_NAME=my-build-env ./rockylinux9/build.sh ```sh docker run --rm -it debian13-source-stack docker run --rm -it rockylinux9-source-stack +docker run --rm -it alpine3.24-source-stack ``` diff --git a/alpine3.24/Dockerfile b/alpine3.24/Dockerfile new file mode 100644 index 0000000..17763f6 --- /dev/null +++ b/alpine3.24/Dockerfile @@ -0,0 +1,593 @@ +FROM docker.io/library/alpine:3.24 + +RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.ustc.edu.cn|g' /etc/apk/repositories \ + && apk add --no-cache \ + autoconf \ + automake \ + build-base \ + bzip2 \ + ca-certificates \ + cmake \ + coreutils \ + curl \ + git \ + libtool \ + linux-headers \ + ninja \ + perl \ + pkgconf \ + tar \ + xz + +RUN git config --global url."https://wangguofang.net/github.com/".insteadOf "https://github.com/" + +RUN curl --fail --location --output boost.tar.bz2 \ + https://mirrors.aliyun.com/blfs/conglomeration/boost/boost_1_83_0.tar.bz2 \ + && mkdir src \ + && tar --extract --bzip2 --file=boost.tar.bz2 --directory=src --strip-components=1 \ + && rm boost.tar.bz2 \ + && cd src \ + && ./bootstrap.sh --prefix=/usr/local \ + && ./b2 --jobs="$(nproc)" \ + --with-atomic \ + --with-chrono \ + --with-context \ + --with-date_time \ + --with-filesystem \ + --with-program_options \ + --with-regex \ + --with-system \ + --with-thread \ + cflags=-fPIC \ + cxxflags=-fPIC \ + link=static \ + pch=off \ + runtime-link=shared \ + threading=multi \ + variant=release \ + install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=openssl-3.0.15 --depth=1 https://github.com/openssl/openssl.git src \ + && cd src \ + && ./Configure --prefix=/usr/local --libdir=lib no-shared no-tests -fPIC \ + && make --jobs="$(nproc)" \ + && make install_sw \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=release-2.1.12-stable --depth=1 https://github.com/libevent/libevent.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DEVENT__DISABLE_BENCHMARK=ON \ + -DEVENT__DISABLE_REGRESS=ON \ + -DEVENT__DISABLE_SAMPLES=ON \ + -DEVENT__DISABLE_TESTS=ON \ + -DEVENT__LIBRARY_TYPE=STATIC \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v1.5.7 --depth=1 https://github.com/facebook/zstd.git src \ + && cmake -G Ninja -S src/build/cmake -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DZSTD_BUILD_CONTRIB=OFF \ + -DZSTD_BUILD_PROGRAMS=OFF \ + -DZSTD_BUILD_SHARED=OFF \ + -DZSTD_BUILD_STATIC=ON \ + -DZSTD_BUILD_TESTS=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v1.3.1 --depth=1 https://github.com/madler/zlib.git src \ + && cd src \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=v3.21.12 --depth=1 https://github.com/protocolbuffers/protobuf.git src \ + && cmake -G Ninja -S src -B build -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_BUILD_SHARED_LIBS=OFF \ + -Dprotobuf_WITH_ZLIB=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=REL_2_0_5 --depth=1 https://gitee.com/mirrors/log4cplus.git src \ + && git -C src submodule update --init --depth=1 threadpool \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLOG4CPLUS_BUILD_TESTING=OFF \ + -DWITH_UNIT_TESTS=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=12.2.0 --depth=1 https://github.com/fmtlib/fmt.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DFMT_DOC=OFF \ + -DFMT_TEST=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v1.17.0 --depth=1 https://github.com/gabime/spdlog.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DSPDLOG_BUILD_BENCH=OFF \ + -DSPDLOG_BUILD_EXAMPLE=OFF \ + -DSPDLOG_BUILD_TESTS=OFF \ + -DSPDLOG_FMT_EXTERNAL=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v0.9.8 --depth=1 https://github.com/Neargye/magic_enum.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF \ + -DMAGIC_ENUM_OPT_BUILD_TESTS=OFF \ + -DMAGIC_ENUM_OPT_INSTALL=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v8.2.10 --depth=1 https://github.com/fastfloat/fast_float.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DFASTFLOAT_BENCHMARKS=OFF \ + -DFASTFLOAT_INSTALL=ON \ + -DFASTFLOAT_TEST=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v0.7.0 --depth=1 https://github.com/Tessil/sparse-map.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v2.3.1 --depth=1 https://github.com/gflags/gflags.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_STATIC_LIBS=ON \ + -DBUILD_TESTING=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DINSTALL_HEADERS=ON \ + -DINSTALL_SHARED_LIBS=OFF \ + -DINSTALL_STATIC_LIBS=ON \ + -DREGISTER_INSTALL_PREFIX=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v0.7.1 --depth=1 https://github.com/google/glog.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTING=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DWITH_GFLAGS=ON \ + -DWITH_GTEST=OFF \ + -DWITH_PKGCONFIG=ON \ + -DWITH_UNWIND=none \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=liburing-2.15 --depth=1 https://github.com/axboe/liburing.git src \ + && cd src \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + && make --jobs="$(nproc)" ENABLE_SHARED=0 library \ + && make ENABLE_SHARED=0 install \ + && cd .. \ + && rm -rf src + +RUN curl --fail --location --output libaio.tar.gz \ + https://releases.pagure.org/libaio/libaio-0.3.113.tar.gz \ + && mkdir src \ + && tar --extract --gzip --file=libaio.tar.gz --directory=src --strip-components=1 \ + && rm libaio.tar.gz \ + && make --directory=src --jobs="$(nproc)" ENABLE_SHARED=0 \ + && make --directory=src ENABLE_SHARED=0 prefix=/usr/local install \ + && rm -rf src + +RUN git clone --branch=v2.3.2 --depth=1 https://github.com/davea42/libdwarf-code.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_DWARFDUMP=OFF \ + -DBUILD_DWARFEXAMPLE=OFF \ + -DBUILD_DWARFGEN=OFF \ + -DBUILD_NON_SHARED=ON \ + -DBUILD_SHARED=OFF \ + -DDO_TESTING=OFF \ + -DENABLE_DECOMPRESSION=ON \ + -DPIC_ALWAYS=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=1.0.20-RELEASE --depth=1 https://github.com/jedisct1/libsodium.git src \ + && cd src \ + && ./autogen.sh \ + && ./configure --prefix=/usr/local --disable-shared --enable-static --with-pic \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=v0.8.3 --depth=1 https://github.com/Cyan4973/xxHash.git src \ + && cmake -G Ninja -S src/cmake_unofficial -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DXXHASH_BUILD_XXHSUM=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v1.17.0 --depth=1 https://github.com/google/googletest.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_GMOCK=ON \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DINSTALL_GTEST=ON \ + -Dgtest_build_samples=OFF \ + -Dgtest_build_tests=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v2.0.19 --depth=1 https://github.com/numactl/numactl.git src \ + && cd src \ + && ./autogen.sh \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --disable-shared --enable-static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +# Meta/Facebook ecosystem libraries (Folly, Fizz, Wangle, mvfst, fbthrift, +# CacheLib) are not built on this musl target: they aren't on Meta's +# supported-OS list, and every compile error traced back so far is Folly +# reaching for a glibc-only macro/symbol with no musl branch in its +# portability layer (e.g. off64_t/lseek64/pread64 in +# folly/portability/Unistd.h, __ELF_NATIVE_CLASS in +# folly/debugging/symbolizer/Elf.cpp). Patching around each one as it +# surfaces is more likely to introduce subtle bugs than to reach a solid +# build, so this stack is intentionally left unbuilt on Alpine. +# RUN git clone --branch=v2026.08.03.00 --depth=1 https://github.com/facebook/folly.git src \ +# && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ +# cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ +# -DBOOST_LINK_STATIC=ON \ +# -DBUILD_BENCHMARKS=OFF \ +# -DBUILD_SHARED_LIBS=OFF \ +# -DBUILD_TESTS=OFF \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +# -DPYTHON_EXTENSIONS=OFF \ +# && cmake --build build --parallel "$(nproc)" --target install \ +# && rm -rf build src + +# RUN git clone --branch=v2026.08.03.00 --depth=1 https://github.com/facebookincubator/fizz.git src \ +# && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ +# cmake -G Ninja -S src/fizz -B build -DCMAKE_BUILD_TYPE=Release \ +# -DBUILD_EXAMPLES=OFF \ +# -DBUILD_SHARED_LIBS=OFF \ +# -DBUILD_TESTS=OFF \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +# -Dsodium_USE_STATIC_LIBS=ON \ +# && cmake --build build --parallel "$(nproc)" --target install \ +# && rm -rf build src + +# RUN git clone --branch=v2026.08.03.00 --depth=1 https://github.com/facebook/wangle.git src \ +# && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ +# cmake -G Ninja -S src/wangle -B build -DCMAKE_BUILD_TYPE=Release \ +# -DBUILD_EXAMPLES=OFF \ +# -DBUILD_SHARED_LIBS=OFF \ +# -DBUILD_TESTS=OFF \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +# && cmake --build build --parallel "$(nproc)" --target install \ +# && rm -rf build src + +# RUN git clone --branch=v2026.08.03.00 --depth=1 https://github.com/facebook/mvfst.git src \ +# && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ +# cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ +# -DBUILD_SAMPLES=OFF \ +# -DBUILD_SHARED_LIBS=OFF \ +# -DBUILD_TESTS=OFF \ +# -DBUILD_TOOLS=OFF \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +# && cmake --build build --parallel "$(nproc)" --target install \ +# && rm -rf build src + +# RUN git clone --branch=v2026.08.03.00 --depth=1 https://github.com/facebook/fbthrift.git src \ +# && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ +# cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ +# -DBUILD_SHARED_LIBS=OFF \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +# -DTHRIFT_BENCHMARKS=OFF \ +# -Denable_tests=OFF \ +# -Dthrift_python=OFF \ +# -Dthriftpy=OFF \ +# -Dthriftpy3=OFF \ +# && cmake --build build --parallel "$(nproc)" --target install \ +# && rm -rf build src + +# RUN git clone --branch=v2026.08.03.00 --depth=1 https://github.com/facebook/CacheLib.git src \ +# && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ +# cmake -G Ninja -S src/cachelib -B build -DCMAKE_BUILD_TYPE=Release \ +# -DBOOST_LINK_STATIC=ON \ +# -DBUILD_SHARED_LIBS=OFF \ +# -DBUILD_TESTS=OFF \ +# -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ +# && cmake --build build --parallel "$(nproc)" --target install \ +# && rm -rf build src + +RUN curl --fail --location --output util-linux.tar.xz \ + https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.2.tar.xz \ + && mkdir src \ + && tar --extract --xz --file=util-linux.tar.xz --directory=src --strip-components=1 \ + && rm util-linux.tar.xz \ + && cd src \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + --disable-all-programs \ + --disable-bash-completion \ + --disable-makeinstall-chown \ + --disable-nls \ + --disable-shared \ + --enable-libuuid \ + --enable-static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=v4.3.5 --depth=1 https://github.com/zeromq/libzmq.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED=OFF \ + -DBUILD_STATIC=ON \ + -DBUILD_TESTS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DENABLE_CPACK=OFF \ + -DENABLE_CURVE=ON \ + -DENABLE_DRAFTS=OFF \ + -DWITH_DOC=OFF \ + -DWITH_DOCS=OFF \ + -DWITH_LIBSODIUM=ON \ + -DWITH_LIBSODIUM_STATIC=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v4.2.1 --depth=1 https://github.com/zeromq/czmq.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCZMQ_BUILD_SHARED=OFF \ + -DCZMQ_BUILD_STATIC=ON \ + -DCZMQ_WITH_LZ4=OFF \ + -DCZMQ_WITH_LIBCURL=OFF \ + -DCZMQ_WITH_LIBMICROHTTPD=OFF \ + -DCZMQ_WITH_NSS=OFF \ + -DCZMQ_WITH_SYSTEMD=OFF \ + -DCZMQ_WITH_UUID=ON \ + -DENABLE_DRAFTS=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=1.9.8 --depth=1 https://github.com/open-source-parsers/jsoncpp.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_OBJECT_LIBS=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_STATIC_LIBS=ON \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DJSONCPP_WITH_EXAMPLE=OFF \ + -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \ + -DJSONCPP_WITH_TESTS=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v2.15.0 --depth=1 https://github.com/confluentinc/librdkafka.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DENABLE_LZ4_EXT=OFF \ + -DRDKAFKA_BUILD_EXAMPLES=OFF \ + -DRDKAFKA_BUILD_STATIC=ON \ + -DRDKAFKA_BUILD_TESTS=OFF \ + -DWITH_CURL=OFF \ + -DWITH_PLUGINS=OFF \ + -DWITH_SASL=OFF \ + -DWITH_SSL=ON \ + -DWITH_ZLIB=ON \ + -DWITH_ZSTD=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=json-c-0.19-20260627 --depth=1 https://github.com/json-c/json-c.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_APPS=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_STATIC_LIBS=ON \ + -DBUILD_TESTING=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DDISABLE_EXTRA_LIBS=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +COPY rapidjson-generic-string-ref-assignment.patch /tmp/ +RUN git clone --branch=v1.1.0 --depth=1 https://github.com/Tencent/rapidjson.git src \ + && git -C src apply /tmp/rapidjson-generic-string-ref-assignment.patch \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DRAPIDJSON_BUILD_DOC=OFF \ + -DRAPIDJSON_BUILD_EXAMPLES=OFF \ + -DRAPIDJSON_BUILD_TESTS=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src /tmp/rapidjson-generic-string-ref-assignment.patch + +RUN git clone --branch=curl-8_21_0 --depth=1 https://github.com/curl/curl.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_CURL_EXE=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_LIBCURL_DOCS=OFF \ + -DBUILD_MISC_DOCS=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_STATIC_LIBS=ON \ + -DBUILD_TESTING=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCURL_BROTLI=OFF \ + -DCURL_USE_LIBPSL=OFF \ + -DCURL_USE_LIBSSH=OFF \ + -DCURL_USE_LIBSSH2=OFF \ + -DCURL_USE_OPENSSL=ON \ + -DENABLE_CURL_MANUAL=OFF \ + -DHTTP_ONLY=ON \ + -DUSE_LIBIDN2=OFF \ + -DUSE_NGHTTP2=OFF \ + -DUSE_NGTCP2=OFF \ + -DUSE_QUICHE=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=v1.4.1 --depth=1 https://github.com/redis/hiredis.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DENABLE_ASYNC_TESTS=OFF \ + -DENABLE_EXAMPLES=OFF \ + -DENABLE_NUGET=OFF \ + -DENABLE_SSL=OFF \ + -DENABLE_SSL_TESTS=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN curl --fail --location --output gmp.tar.xz \ + https://mirrors.ustc.edu.cn/gnu/gmp/gmp-6.3.0.tar.xz \ + && mkdir src \ + && tar --extract --xz --file=gmp.tar.xz --directory=src --strip-components=1 \ + && rm gmp.tar.xz \ + && cd src \ + && CFLAGS="-fPIC -std=gnu17" ./configure --prefix=/usr/local --disable-shared --enable-static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN curl --fail --location --output nettle.tar.gz \ + https://mirrors.ustc.edu.cn/gnu/nettle/nettle-3.10.2.tar.gz \ + && mkdir src \ + && tar --extract --gzip --file=nettle.tar.gz --directory=src --strip-components=1 \ + && rm nettle.tar.gz \ + && cd src \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib \ + --disable-documentation \ + --disable-shared \ + --enable-static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN curl --fail --location --output gnutls.tar.xz \ + https://mirrors.dotsrc.org/gcrypt/gnutls/v3.8/gnutls-3.8.13.tar.xz \ + && mkdir src \ + && tar --extract --xz --file=gnutls.tar.xz --directory=src --strip-components=1 \ + && rm gnutls.tar.xz \ + && cd src \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + --with-included-libtasn1 \ + --with-included-unistring \ + --disable-cxx \ + --disable-doc \ + --disable-manpages \ + --disable-nls \ + --disable-shared \ + --disable-tests \ + --disable-tools \ + --enable-static \ + --without-brotli \ + --without-idn \ + --without-p11-kit \ + --without-tpm \ + --without-tpm2 \ + --without-zlib \ + --without-zstd \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=1.13.3 --depth=1 https://github.com/maxmind/libmaxminddb.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DBUILD_TESTING=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DMAXMINDDB_BUILD_BINARIES=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=0.2.5 --depth=1 https://github.com/yaml/libyaml.git src \ + && cd src \ + && ./bootstrap \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --disable-shared --enable-static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=v2.15.3 --depth=1 https://gitlab.gnome.org/GNOME/libxml2.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLIBXML2_WITH_DOCS=OFF \ + -DLIBXML2_WITH_ICU=OFF \ + -DLIBXML2_WITH_MODULES=OFF \ + -DLIBXML2_WITH_PROGRAMS=OFF \ + -DLIBXML2_WITH_PYTHON=OFF \ + -DLIBXML2_WITH_TESTS=OFF \ + -DLIBXML2_WITH_ZLIB=ON \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=1.3.15 --depth=1 https://github.com/sewenew/redis-plus-plus.git src \ + && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DREDIS_PLUS_PLUS_BUILD_SHARED=OFF \ + -DREDIS_PLUS_PLUS_BUILD_STATIC=ON \ + -DREDIS_PLUS_PLUS_BUILD_STATIC_WITH_PIC=ON \ + -DREDIS_PLUS_PLUS_BUILD_TEST=OFF \ + && cmake --build build --parallel "$(nproc)" --target install \ + && rm -rf build src + +RUN git clone --branch=5.3.1 --depth=1 https://github.com/jemalloc/jemalloc.git src \ + && cd src \ + && ./autogen.sh \ + && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=/usr/local \ + --disable-doc \ + --disable-shared \ + --enable-static \ + && make --jobs="$(nproc)" \ + && make install \ + && cd .. \ + && rm -rf src + +RUN git clone --branch=release-2.7.1 --depth=1 https://github.com/megastep/makeself.git src \ + && cp src/makeself.sh src/makeself-header.sh /usr/local/bin/ \ + && ln -s makeself.sh /usr/local/bin/makeself \ + && rm -rf src + +CMD ["/bin/sh"] diff --git a/alpine3.24/build.sh b/alpine3.24/build.sh new file mode 100755 index 0000000..b4a3339 --- /dev/null +++ b/alpine3.24/build.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -eu + +IMAGE_NAME="${IMAGE_NAME:-alpine3.24-source-stack}" +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) + +if [ -n "${CONTAINER_ENGINE:-}" ]; then + ENGINE=$CONTAINER_ENGINE +elif command -v docker >/dev/null 2>&1; then + ENGINE=docker +elif command -v podman >/dev/null 2>&1; then + ENGINE=podman +else + echo "Error: Docker or Podman is required." >&2 + exit 1 +fi + +echo "Building image $IMAGE_NAME with $ENGINE ..." +exec "$ENGINE" build --tag "$IMAGE_NAME" "$SCRIPT_DIR" diff --git a/alpine3.24/rapidjson-generic-string-ref-assignment.patch b/alpine3.24/rapidjson-generic-string-ref-assignment.patch new file mode 100644 index 0000000..ddf76b0 --- /dev/null +++ b/alpine3.24/rapidjson-generic-string-ref-assignment.patch @@ -0,0 +1,12 @@ +diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h +index e3e20df..6d4c1a4 100644 +--- a/include/rapidjson/document.h ++++ b/include/rapidjson/document.h +@@ -317,6 +317,6 @@ struct GenericStringRef { + GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {} + +- GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } ++ GenericStringRef& operator=(const GenericStringRef& rhs) /* = delete */; + + //! implicit conversion to plain CharType pointer + operator const Ch *() const { return s; } diff --git a/build-all.sh b/build-all.sh index 02ec149..082b143 100755 --- a/build-all.sh +++ b/build-all.sh @@ -6,3 +6,4 @@ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) "$SCRIPT_DIR/debian13/build.sh" "$SCRIPT_DIR/rockylinux9/build.sh" +"$SCRIPT_DIR/alpine3.24/build.sh"