Skip to content

Commit e9e18cb

Browse files
feat(core): Add support for building and running on musllinux_1_2; Add musllinux_1_2 dependency container images. (#1054)
Co-authored-by: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com>
1 parent 9dc9421 commit e9e18cb

File tree

13 files changed

+193
-6
lines changed

13 files changed

+193
-6
lines changed

components/core/src/clp/SQLitePreparedStatement.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef CLP_SQLITEPREPAREDSTATEMENT_HPP
22
#define CLP_SQLITEPREPAREDSTATEMENT_HPP
33

4+
#include <cstdint>
45
#include <string>
56

67
#include <sqlite3/sqlite3.h>

components/core/src/clp_s/Utils.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <array>
55
#include <charconv>
6+
#include <cstdint>
67
#include <cstring>
78
#include <sstream>
89
#include <string>

components/core/src/glt/SQLitePreparedStatement.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef GLT_SQLITEPREPAREDSTATEMENT_HPP
22
#define GLT_SQLITEPREPAREDSTATEMENT_HPP
33

4+
#include <cstdint>
45
#include <string>
56

67
#include <sqlite3/sqlite3.h>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM quay.io/pypa/musllinux_1_2_aarch64
2+
3+
WORKDIR /root
4+
5+
RUN mkdir -p ./tools/scripts/lib_install
6+
COPY ./tools/scripts/lib_install ./tools/scripts/lib_install
7+
8+
RUN ./tools/scripts/lib_install/musllinux_1_2/install-all.sh
9+
10+
# Remove cached files
11+
RUN apk cache clean --all && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
7+
component_root="${script_dir}/../../../"
8+
9+
build_cmd=(
10+
docker buildx build
11+
--platform linux/arm64
12+
--tag clp-core-dependencies-aarch64-musllinux_1_2:dev
13+
"$component_root"
14+
--file "${script_dir}/Dockerfile"
15+
--load
16+
)
17+
18+
if command -v git >/dev/null && git -C "$script_dir" rev-parse --is-inside-work-tree >/dev/null ;
19+
then
20+
build_cmd+=(
21+
--label "org.opencontainers.image.revision=$(git -C "$script_dir" rev-parse HEAD)"
22+
--label "org.opencontainers.image.source=$(git -C "$script_dir" remote get-url origin)"
23+
)
24+
fi
25+
26+
echo "Running: ${build_cmd[*]}"
27+
"${build_cmd[@]}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM quay.io/pypa/musllinux_1_2_x86_64 AS base
2+
3+
WORKDIR /root
4+
5+
RUN mkdir -p ./tools/scripts/lib_install
6+
COPY ./tools/scripts/lib_install ./tools/scripts/lib_install
7+
8+
RUN ./tools/scripts/lib_install/musllinux_1_2/install-all.sh
9+
10+
# Remove cached files
11+
RUN apk cache clean --all && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
7+
component_root="${script_dir}/../../../"
8+
9+
build_cmd=(
10+
docker buildx build
11+
--platform linux/amd64
12+
--tag clp-core-dependencies-x86-musllinux_1_2:dev
13+
"$component_root"
14+
--file "${script_dir}/Dockerfile"
15+
--load
16+
)
17+
18+
if command -v git >/dev/null && git -C "$script_dir" rev-parse --is-inside-work-tree >/dev/null ;
19+
then
20+
build_cmd+=(
21+
--label "org.opencontainers.image.revision=$(git -C "$script_dir" rev-parse HEAD)"
22+
--label "org.opencontainers.image.source=$(git -C "$script_dir" remote get-url origin)"
23+
)
24+
fi
25+
26+
echo "Running: ${build_cmd[*]}"
27+
"${build_cmd[@]}"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
7+
8+
"${script_dir}/install-prebuilt-packages.sh"
9+
"${script_dir}/install-packages-from-source.sh"
10+
11+
# TODO: https://github.com/y-scope/clp/issues/795
12+
"${script_dir}/../check-cmake-version.sh"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
7+
lib_install_scripts_dir="${script_dir}/.."
8+
9+
# NOTE: The remaining installation scripts depend on boost, so we install it beforehand.
10+
"${lib_install_scripts_dir}/install-boost.sh" 1.87.0
11+
12+
# NOTE:
13+
# 1. libarchive may statically link with LZMA, LZ4, and Zstandard, so we install them beforehand.
14+
# 2. The versions of libarchive, LZMA, LZ4, and Zstandard available in musllinux_1_2's package
15+
# repositories are either dated or don't include static libraries, so we install more recent
16+
# versions from source.
17+
"${lib_install_scripts_dir}/liblzma.sh" 5.8.1
18+
"${lib_install_scripts_dir}/lz4.sh" 1.10.0
19+
"${lib_install_scripts_dir}/zstandard.sh" 1.5.7
20+
"${lib_install_scripts_dir}/libarchive.sh" 3.8.0
21+
22+
"${lib_install_scripts_dir}/msgpack.sh" 7.0.0
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
apk update && apk add --no-cache \
7+
bzip2-dev \
8+
bzip2-static \
9+
curl-dev \
10+
jq \
11+
mariadb-connector-c-dev \
12+
openjdk11-jdk \
13+
openssl-dev \
14+
zlib-dev \
15+
zlib-static
16+
17+
# Determine architecture for `task` release to install
18+
arch=$(uname -m)
19+
case "$arch" in
20+
"x86_64")
21+
task_pkg_arch="amd64"
22+
;;
23+
"aarch64")
24+
task_pkg_arch="arm64"
25+
;;
26+
*)
27+
echo "Error: Unsupported architecture - $arch"
28+
exit 1
29+
;;
30+
esac
31+
32+
# Install `task`
33+
# NOTE: We lock `task` to a version < 3.43 to avoid https://github.com/y-scope/clp/issues/872
34+
task_pkg_path=$(mktemp -t task-pkg.XXXXXXXXXX).tar.gz || exit 1
35+
curl \
36+
--fail \
37+
--location \
38+
--output "$task_pkg_path" \
39+
--show-error \
40+
"https://github.com/go-task/task/releases/download/v3.42.1/task_linux_${task_pkg_arch}.tar.gz"
41+
tar -C /usr/local/bin -xzf "$task_pkg_path" task
42+
chmod +x /usr/local/bin/task
43+
rm "$task_pkg_path"
44+
45+
# Downgrade to CMake v3 to work around https://github.com/y-scope/clp/issues/795
46+
pipx uninstall cmake
47+
pipx install cmake~=3.31

0 commit comments

Comments
 (0)