Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
596ffc1567 | ||
|
|
4b587550a1 |
@@ -1,233 +0,0 @@
|
||||
# .gitea/workflows/ci.yaml
|
||||
name: Build and Release Mond
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master, develop]
|
||||
tags: ['*']
|
||||
|
||||
env:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
PRODUCT_NAME: "mond"
|
||||
PACKAGE_VERSION: "0.18.5.0"
|
||||
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
run: |
|
||||
# 创建 buildx builder(原生构建不需要 QEMU)
|
||||
docker buildx create --use --name native-builder \
|
||||
--driver docker-container \
|
||||
--driver-opt network=host \
|
||||
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
|
||||
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000 \
|
||||
|| true
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: Build binaries
|
||||
run: |
|
||||
PLATFORM="linux/${{ matrix.arch }}"
|
||||
MONERO_VERSION="v${PACKAGE_VERSION}" # 上游 Monero git tag 带 v 前缀,需补回
|
||||
|
||||
# 设置 BuildKit 优化参数
|
||||
export BUILDKIT_PROGRESS=plain
|
||||
|
||||
docker buildx build --pull \
|
||||
--platform ${PLATFORM} \
|
||||
--build-arg MONERO_VERSION=${MONERO_VERSION} \
|
||||
--output type=local,dest=./output \
|
||||
-f docker/Dockerfile .
|
||||
|
||||
- name: Package and test
|
||||
run: |
|
||||
DIR="./output/linux_${{ matrix.arch }}"
|
||||
VERSION=${PACKAGE_VERSION}
|
||||
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
|
||||
|
||||
tar -czf "${TARGZ}" -C "$DIR" .
|
||||
|
||||
echo "📦 Created package: ${TARGZ}"
|
||||
ls -lh "${TARGZ}"
|
||||
|
||||
# 快速验证
|
||||
mkdir -p test && tar -xzf "${TARGZ}" -C test
|
||||
test/mond --version 2>/dev/null || echo "⚠️ 跳过版本检查"
|
||||
# 依赖校验:musl fully-static,ldd 应为 "statically linked"(零外部依赖,glibc/musl 均可直接运行)
|
||||
if ldd test/mond 2>&1 | grep -qE 'statically linked|not a dynamic executable'; then
|
||||
echo "✅ fully-static(无任何动态依赖,跨发行版)"
|
||||
else
|
||||
echo "⚠️ 非纯静态,仍有动态依赖:"; ldd test/mond
|
||||
fi
|
||||
rm -rf test
|
||||
|
||||
- name: Build Debian package
|
||||
run: |
|
||||
# 安装 dpkg-deb(如果需要)
|
||||
sudo apt-get update && sudo apt-get install -y dpkg-dev
|
||||
|
||||
VERSION=${PACKAGE_VERSION}
|
||||
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
|
||||
|
||||
echo "📦 Building Debian package for ${{ matrix.arch }}..."
|
||||
chmod +x debian/build-deb.sh
|
||||
./debian/build-deb.sh ${{ matrix.arch }} ${VERSION} "${TARGZ}"
|
||||
|
||||
ls -lh *.deb
|
||||
|
||||
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: binaries-${{ matrix.arch }}
|
||||
path: |
|
||||
*.tar.gz
|
||||
*.deb
|
||||
retention-days: 1
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest-amd64
|
||||
needs: build-and-test
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
steps:
|
||||
- uses: https://github.com/ChristopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
pattern: binaries-*
|
||||
path: ./packages
|
||||
merge-multiple: true
|
||||
|
||||
- name: Upload packages and create release
|
||||
env:
|
||||
TOKEN: ${{ secrets.BUILD_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
cd packages
|
||||
|
||||
# 提取仓库信息(移除 https:// 前缀和仓库路径)
|
||||
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
OWNER="${{ gitea.repository_owner }}"
|
||||
REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2)
|
||||
VERSION="${TAG#v}" # 包版本:去掉 git tag 的 v 前缀(registry 路径/下载名/Release 标题统一用)
|
||||
|
||||
echo "📦 上传包到 Generic Package Registry..."
|
||||
echo " Registry: ${REGISTRY}"
|
||||
echo " Owner: ${OWNER}"
|
||||
echo " Package: ${PRODUCT_NAME}"
|
||||
echo " Version: ${VERSION}"
|
||||
|
||||
# 上传所有 tar.gz 包到 Generic Package Registry
|
||||
for file in *.tar.gz; do
|
||||
[ ! -f "$file" ] && continue
|
||||
echo " ⬆️ $file"
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
--upload-file "$file" \
|
||||
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/$file" || {
|
||||
echo "❌ 上传失败: $file"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
# 上传 Debian 包到 Debian Package Registry (通用稳定版)
|
||||
echo ""
|
||||
echo "📦 上传 Debian 包到 Debian Package Registry..."
|
||||
for file in *.deb; do
|
||||
[ ! -f "$file" ] && continue
|
||||
|
||||
# 上传到 stable (通用稳定版)
|
||||
echo " ⬆️ $file → stable"
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
--upload-file "$file" \
|
||||
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/stable/main/upload" || {
|
||||
echo "❌ Debian 包上传失败: $file (stable)"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
# 生成 Release 描述
|
||||
echo ""
|
||||
echo "📝 生成 Release..."
|
||||
|
||||
# 拼接 tar.gz 下载链接
|
||||
ASSETS=$(for f in *.tar.gz; do
|
||||
[ -f "$f" ] || continue
|
||||
echo "- [\`$f\`](https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/$f)"
|
||||
done)
|
||||
|
||||
BODY=$(cat <<EOF
|
||||
## Release ${VERSION}
|
||||
|
||||
### 📥 Debian/Ubuntu 安装
|
||||
|
||||
\`\`\`bash
|
||||
sudo curl https://${REGISTRY}/api/packages/${OWNER}/debian/repository.key -o /etc/apt/keyrings/gitea-${OWNER}.asc
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gitea-${OWNER}.asc] https://${REGISTRY}/api/packages/${OWNER}/debian stable main" | sudo tee /etc/apt/sources.list.d/${OWNER}.list
|
||||
sudo apt-get update && sudo apt-get install ${PRODUCT_NAME}
|
||||
\`\`\`
|
||||
|
||||
### 📦 tar.gz 下载
|
||||
|
||||
${ASSETS}
|
||||
EOF
|
||||
)
|
||||
|
||||
RELEASE_DATA=$(jq -n --arg tag "$TAG" --arg ver "$VERSION" --arg body "$BODY" \
|
||||
'{tag_name: $tag, name: "Release \($ver)", body: $body, draft: false, prerelease: false}')
|
||||
|
||||
# 创建 Release
|
||||
echo ""
|
||||
echo "🎉 创建 Release..."
|
||||
RESPONSE=$(curl -fsSL -w "\n%{http_code}" -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||
-d "${RELEASE_DATA}")
|
||||
|
||||
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||
RESPONSE_BODY=$(echo "$RESPONSE" | head -n-1)
|
||||
|
||||
if [ "$HTTP_CODE" = "201" ]; then
|
||||
echo "✅ Release 创建成功"
|
||||
RELEASE_ID=$(echo "$RESPONSE_BODY" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||
echo " Release ID: ${RELEASE_ID}"
|
||||
elif [ "$HTTP_CODE" = "409" ]; then
|
||||
echo "⚠️ Release 已存在,获取现有 Release ID..."
|
||||
RELEASE_ID=$(curl -fsSL \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/tags/${TAG}" | \
|
||||
grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
|
||||
echo " Release ID: ${RELEASE_ID}"
|
||||
else
|
||||
echo "❌ 创建 Release 失败 (HTTP ${HTTP_CODE})"
|
||||
echo "$RESPONSE_BODY"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 上传文件作为 Release 附件
|
||||
echo ""
|
||||
echo "📎 上传文件作为 Release 附件..."
|
||||
for file in *.tar.gz *.deb; do
|
||||
[ ! -f "$file" ] && continue
|
||||
echo " ⬆️ $file"
|
||||
|
||||
# 使用 multipart/form-data 上传附件
|
||||
curl -fsSL -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-F "attachment=@${file}" \
|
||||
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${file}" || {
|
||||
echo " ⚠️ 附件上传失败: $file(可能已存在)"
|
||||
}
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✅ Release 创建完成!"
|
||||
echo "🔗 访问: https://${REGISTRY}/${{ gitea.repository }}/releases/tag/${TAG}"
|
||||
|
||||
# 清理临时文件
|
||||
rm -f release_body.md
|
||||
@@ -0,0 +1,83 @@
|
||||
name: CI
|
||||
|
||||
# 分支推送只做校验和原生构建;tag 发布由 release.yml 独立处理。
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
|
||||
env:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
|
||||
BUILDKIT_PROGRESS: plain
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 校验版本、配置和脚本语法
|
||||
run: |
|
||||
VERSION=$(tr -d '\r\n' < VERSION)
|
||||
[[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]
|
||||
test -s conf/params.example.conf
|
||||
bash -n debian/build-deb.sh
|
||||
sh -n init.sh debian/postinst debian/prerm debian/postrm
|
||||
|
||||
build:
|
||||
needs: validate
|
||||
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 准备原生 Buildx
|
||||
run: |
|
||||
BUILDER=$(docker buildx create --use \
|
||||
--driver docker-container \
|
||||
--driver-opt network=host \
|
||||
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
|
||||
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000)
|
||||
echo "BUILDER=${BUILDER}" >> "$GITHUB_ENV"
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: 构建 ${{ matrix.arch }} 二进制
|
||||
run: |
|
||||
VERSION=$(tr -d '\r\n' < VERSION)
|
||||
docker buildx build --pull \
|
||||
--platform "linux/${{ matrix.arch }}" \
|
||||
--build-arg "MONERO_VERSION=v${VERSION}" \
|
||||
--output type=local,dest=./output \
|
||||
-f docker/Dockerfile .
|
||||
|
||||
- name: 冒烟测试
|
||||
run: |
|
||||
DIR="./output/linux_${{ matrix.arch }}"
|
||||
test -x "${DIR}/mond"
|
||||
"${DIR}/mond" --version
|
||||
"${DIR}/mond" --help >/dev/null
|
||||
LDD_OUT=$(ldd "${DIR}/mond" 2>&1 || true)
|
||||
grep -qE 'statically linked|not a dynamic executable' <<<"${LDD_OUT}"
|
||||
|
||||
- name: 验证 Debian 打包
|
||||
run: |
|
||||
VERSION=$(tr -d '\r\n' < VERSION)
|
||||
TARGZ="mond-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
|
||||
tar -czf "${TARGZ}" -C "./output/linux_${{ matrix.arch }}" .
|
||||
if ! command -v dpkg-deb >/dev/null; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y dpkg-dev
|
||||
fi
|
||||
./debian/build-deb.sh "${{ matrix.arch }}" "${VERSION}" "${TARGZ}"
|
||||
DEB="mond_${VERSION}_${{ matrix.arch }}.deb"
|
||||
CONTENTS=$(dpkg-deb --contents "${DEB}")
|
||||
grep -Fq 'opt/mond/mond' <<<"${CONTENTS}"
|
||||
grep -Fq 'opt/mond/params.conf' <<<"${CONTENTS}"
|
||||
grep -Fq 'lib/systemd/system/mond.service' <<<"${CONTENTS}"
|
||||
|
||||
- name: 清理 Buildx
|
||||
if: always()
|
||||
run: docker buildx rm "${BUILDER}" || true
|
||||
@@ -0,0 +1,169 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["*"]
|
||||
|
||||
env:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
|
||||
BUILDKIT_PROGRESS: plain
|
||||
PRODUCT_NAME: mond
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest-amd64' || 'ubuntu-latest-arm64' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 校验 tag 与源码版本
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
VERSION=$(tr -d '\r\n' < VERSION)
|
||||
TAG_VERSION="${TAG#v}"
|
||||
[[ "${TAG_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]
|
||||
[ "${TAG_VERSION}" = "${VERSION}" ] || {
|
||||
echo "tag ${TAG_VERSION} 与 VERSION ${VERSION} 不一致"
|
||||
exit 1
|
||||
}
|
||||
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: 准备原生 Buildx
|
||||
run: |
|
||||
BUILDER=$(docker buildx create --use \
|
||||
--driver docker-container \
|
||||
--driver-opt network=host \
|
||||
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
|
||||
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000)
|
||||
echo "BUILDER=${BUILDER}" >> "$GITHUB_ENV"
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
- name: 构建 ${{ matrix.arch }} 二进制
|
||||
run: |
|
||||
docker buildx build --pull \
|
||||
--platform "linux/${{ matrix.arch }}" \
|
||||
--build-arg "MONERO_VERSION=v${VERSION}" \
|
||||
--output type=local,dest=./output \
|
||||
-f docker/Dockerfile .
|
||||
|
||||
- name: 打包并冒烟测试
|
||||
run: |
|
||||
DIR="./output/linux_${{ matrix.arch }}"
|
||||
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
|
||||
test -x "${DIR}/mond"
|
||||
tar -czf "${TARGZ}" -C "${DIR}" .
|
||||
TEST_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "${TEST_DIR}"' EXIT
|
||||
tar -xzf "${TARGZ}" -C "${TEST_DIR}"
|
||||
"${TEST_DIR}/mond" --version
|
||||
"${TEST_DIR}/mond" --help >/dev/null
|
||||
LDD_OUT=$(ldd "${TEST_DIR}/mond" 2>&1 || true)
|
||||
grep -qE 'statically linked|not a dynamic executable' <<<"${LDD_OUT}"
|
||||
|
||||
- name: 构建 Debian 包
|
||||
run: |
|
||||
if ! command -v dpkg-deb >/dev/null; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y dpkg-dev
|
||||
fi
|
||||
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-linux-static-${VERSION}.tar.gz"
|
||||
./debian/build-deb.sh "${{ matrix.arch }}" "${VERSION}" "${TARGZ}"
|
||||
DEB="${PRODUCT_NAME}_${VERSION}_${{ matrix.arch }}.deb"
|
||||
CONTENTS=$(dpkg-deb --contents "${DEB}")
|
||||
grep -Fq 'opt/mond/mond' <<<"${CONTENTS}"
|
||||
grep -Fq 'opt/mond/params.conf' <<<"${CONTENTS}"
|
||||
grep -Fq 'lib/systemd/system/mond.service' <<<"${CONTENTS}"
|
||||
|
||||
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: packages-${{ matrix.arch }}
|
||||
path: |
|
||||
*.tar.gz
|
||||
*.deb
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: 清理 Buildx
|
||||
if: always()
|
||||
run: docker buildx rm "${BUILDER}" || true
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: https://github.com/ChristopherHX/gitea-download-artifact@v4
|
||||
with:
|
||||
pattern: packages-*
|
||||
path: ./packages
|
||||
merge-multiple: true
|
||||
|
||||
- name: 校验发布文件并生成校验和
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: |
|
||||
VERSION=$(tr -d '\r\n' < VERSION)
|
||||
TAG_VERSION="${TAG#v}"
|
||||
[ "${TAG_VERSION}" = "${VERSION}" ]
|
||||
for arch in amd64 arm64; do
|
||||
test -f "packages/${PRODUCT_NAME}-${arch}-linux-static-${VERSION}.tar.gz"
|
||||
test -f "packages/${PRODUCT_NAME}_${VERSION}_${arch}.deb"
|
||||
done
|
||||
(cd packages && sha256sum *.tar.gz *.deb > SHA256SUMS)
|
||||
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
|
||||
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
|
||||
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: 上传 Generic 和 Debian 软件包
|
||||
env:
|
||||
TOKEN: ${{ secrets.BUILD_TOKEN }}
|
||||
run: |
|
||||
OWNER="${{ gitea.repository_owner }}"
|
||||
for file in packages/*.tar.gz; do
|
||||
name=$(basename "${file}")
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
--upload-file "${file}" \
|
||||
"https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${VERSION}/${name}"
|
||||
done
|
||||
for file in packages/*.deb; do
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
--upload-file "${file}" \
|
||||
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/stable/main/upload"
|
||||
done
|
||||
|
||||
- name: 生成 Release 描述
|
||||
run: |
|
||||
cat > release-notes.md <<EOF
|
||||
## Release ${VERSION}
|
||||
|
||||
上游版本:[Monero v${VERSION}](https://github.com/monero-project/monero/releases/tag/v${VERSION})
|
||||
|
||||
### Debian/Ubuntu 安装
|
||||
|
||||
\`\`\`bash
|
||||
sudo curl https://${REGISTRY}/api/packages/${{ gitea.repository_owner }}/debian/repository.key -o /etc/apt/keyrings/gitea-${{ gitea.repository_owner }}.asc
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gitea-${{ gitea.repository_owner }}.asc] https://${REGISTRY}/api/packages/${{ gitea.repository_owner }}/debian stable main" | sudo tee /etc/apt/sources.list.d/${{ gitea.repository_owner }}.list
|
||||
sudo apt-get update && sudo apt-get install mond
|
||||
\`\`\`
|
||||
|
||||
发布附件包含 amd64、arm64 的 tar.gz、Debian 包和 SHA256SUMS。
|
||||
EOF
|
||||
|
||||
- name: 创建或更新 Release 并上传附件
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.BUILD_TOKEN }}
|
||||
name: Release ${{ gitea.ref_name }}
|
||||
body_path: release-notes.md
|
||||
files: |
|
||||
packages/*.tar.gz
|
||||
packages/*.deb
|
||||
packages/SHA256SUMS
|
||||
@@ -11,7 +11,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
mond 是 Monero 守护进程 `monerod` 的定制换名构建。换名通过 [init.sh](init.sh) 在编译期对源码做 `sed` 改写完成:`project(monero)→project(mond)`、二进制 `OUTPUT_NAME monerod→mond`、`MONERO_VERSION_*` 宏 → `MOND_VERSION_*`、用户可见字符串 `Monero→Mond`。**改动版本宏或显示字符串相关逻辑时,改 init.sh 而非源码**(源码每次构建都重新克隆)。init.sh 末尾还含 musl 纯静态所需的 CMakeLists patch(见下「为何 patch」)。
|
||||
|
||||
> **与同目录 `gitea-xxxig` / `gitea-xxxig-proxy` 的关键差异**:那两个项目源码来自 `wangdefaa`(双 a)换名仓库;mond 直接克隆 Monero 官方仓库,靠 init.sh 现场改名。三者共享同一套 CI / build-deb / debian 打包骨架,且均为 **musl fully-static** 构建;mond 的版本号格式为四段 `0.18.5.0`。
|
||||
> **与同目录 `gitea-xxxig` / `gitea-xxxig-proxy` 的关键差异**:那两个项目源码来自 `wangdefaa`(双 a)换名仓库;mond 直接克隆 Monero 官方仓库,靠 init.sh 现场改名。三者共享同一套 CI / build-deb / debian 打包骨架,且均为 **musl fully-static** 构建;mond 的版本号格式为四段 `0.18.5.1`。
|
||||
|
||||
## 整体架构:单二进制
|
||||
|
||||
@@ -19,16 +19,16 @@ mond 是 Monero 守护进程 `monerod` 的定制换名构建。换名通过 [ini
|
||||
|
||||
## 构建与发布流程(CI)
|
||||
|
||||
[.gitea/workflows/ci.yaml](.gitea/workflows/ci.yaml) 是 Gitea Actions 流水线:
|
||||
Gitea Actions 拆成两条独立流水线:
|
||||
|
||||
1. **build-and-test**(矩阵 `arch=[amd64,arm64]`,跑在对应架构原生 runner):用 `docker buildx` 按 [docker/Dockerfile](docker/Dockerfile) 原生编译 → 打成 tar.gz → 解包冒烟测试(`mond --version` + `ldd` 纯静态校验)→ 调 `debian/build-deb.sh` 打 .deb → 上传 artifact。
|
||||
2. **release**(仅 tag 触发):下载 artifact,上传 tar.gz 到 Generic Package Registry、上传 .deb 到 Debian Registry(stable/main),并用 `jq` 生成描述创建 Gitea Release。
|
||||
1. [.gitea/workflows/ci.yml](.gitea/workflows/ci.yml) 仅由分支推送触发:先检查版本、配置与 shell 语法,再用 amd64、arm64 原生 runner 并行编译,执行严格冒烟测试并验证 DEB 包内容;不上传 artifact。
|
||||
2. [.gitea/workflows/release.yml](.gitea/workflows/release.yml) 仅由 tag 推送触发:校验 tag 与 [VERSION](VERSION) 一致,双架构原生构建 → tar.gz → DEB → artifact 汇总 → SHA256SUMS → Generic/Debian Registry → Gitea Release。
|
||||
|
||||
关键点:
|
||||
- **musl fully-static(Alpine 构建,勿改回 glibc)**:[docker/Dockerfile](docker/Dockerfile) 在 `alpine:3.23` 下手动源码编译 5 个静态库(OpenSSL 3.0.16 / libsodium / libzmq / expat / unbound——Alpine 仓库只有 `.so`/缺 `.a`,须 `--disable-shared` 自编),编出 **static-pie 纯静态**二进制:`ldd` = `statically linked`、零外部依赖,**glibc/musl 任意发行版直接运行**(实测 musl 产物在 Debian 13 上正常运行)。`make daemon` 约 7 分钟/架构(5 库命中 Docker 层缓存后),远快于原 glibc depends 系统的 30–60 分钟。
|
||||
- **musl fully-static(Alpine 构建,勿改回 glibc)**:[docker/Dockerfile](docker/Dockerfile) 在 `alpine:3.23` 下手动源码编译 5 个静态库(OpenSSL 3.0.21 / libsodium 1.0.20 / libzmq 4.3.5 / expat 2.6.4 / unbound 1.25.1),编出 **static-pie 纯静态**二进制:`ldd` = `statically linked`、零外部依赖,**glibc/musl 任意发行版直接运行**(实测 musl 产物在 Debian 13 上正常运行)。`make daemon` 约 7 分钟/架构(5 库命中 Docker 层缓存后),远快于原 glibc depends 系统的 30–60 分钟。
|
||||
- **为何用 musl 而非 glibc 全静态**:glibc 的 `getaddrinfo` 依赖运行时 `dlopen` NSS 模块,`-static` 全静态后无法加载 → DNS 解析失败(`DNS error: resource busy or locked`);musl 的 `getaddrinfo` 自带实现,全静态也能正常解析。与 `gitea-xxxig`/`gitea-xxxig-proxy` 一致。曾用的 glibc(ubuntu) depends 构建线已删除。
|
||||
- **为何 patch monero 源码([init.sh](init.sh) 末尾,勿删)**:monero 官方明确「不支持 fully static」——`CMakeLists.txt` 中 `STATIC=ON` 在 Linux 只加 `-static-libgcc -static-libstdc++`(非真 `-static`),且强制追加 `-pie` 安全加固,会让链接结果带 musl interpreter、退化成动态。故 init.sh 用 `sed` 去掉 `-pie`、把 Linux 的 `STATIC_FLAGS` 改成真 `-static`。Alpine gcc 默认 PIE,`-static` 自动产出 static-pie(零外部依赖)。
|
||||
- **版本号约定**:包版本硬编码在 ci.yaml 的 `PACKAGE_VERSION: "0.18.5.0"`(**纯数字、无 v**,符合 Debian 版本规范)。**关键分界**:上游 Monero git tag 带 `v`,故 build job 用 `MONERO_VERSION=v${PACKAGE_VERSION}` 补回 v 传给 Dockerfile `git clone --branch`;tar.gz / deb / registry 路径 / Release 标题等包版本一律直接用 `${PACKAGE_VERSION}`;release job 用 `VERSION="${TAG#v}"` 归一(tag 带不带 v 都兼容)。CI 触发条件为 `tags: ['*']`,发版改 `PACKAGE_VERSION` 并打对应 tag(纯数字,如 `0.18.5.0`)。
|
||||
- **为何 patch monero 源码([init.sh](init.sh) 末尾,勿删)**:monero 官方明确「不支持 fully static」——`CMakeLists.txt` 中 `STATIC=ON` 在 Linux 只加 `-static-libgcc -static-libstdc++`(非真 `-static`),且强制追加 `-pie` 安全加固,会让链接结果带 musl interpreter、退化成动态。故 init.sh 用 `sed` 去掉 `-pie`、把 Linux 的 `STATIC_FLAGS` 改成真 `-static`。Alpine gcc 默认 PIE,`-static` 自动产出 static-pie(零外部依赖)。init.sh 在修改前后都会校验关键锚点,上游结构变化时必须直接失败,不能跳过补丁继续构建。
|
||||
- **版本号约定**:根目录 [VERSION](VERSION) 是唯一版本来源,内容为不带 `v` 的四段版本号(当前 `0.18.5.1`)。上游 Monero git tag 带 `v`,构建时补回后传给 Dockerfile;tar.gz、DEB 和 Registry 路径使用纯数字版本。发布 tag 可带或不带 `v`,归一后必须与 VERSION 完全一致。
|
||||
- **依赖精简**:5 个静态库 + libstdc++/libgcc 全部静态链入(真 `-static`),故 [debian/control.template](debian/control.template) **无 `Depends` 字段**(纯静态,连 libc6 都不需要)。
|
||||
- 架构映射:Dockerfile 内 `arm64→ARCH=armv8-a / BUILD_TAG=linux-armv8`、`amd64→ARCH=x86-64 / BUILD_TAG=linux-x64`(传给 monero cmake);OpenSSL target `aarch64→linux-aarch64`、`x86_64→linux-x86_64`。
|
||||
- tar.gz 下载 URL 形如 `https://gitea.bcde.io/api/packages/wangdefa/generic/mond/{version}/mond-{arch}-linux-static-{version}.tar.gz`(version 为纯数字)。
|
||||
@@ -38,18 +38,18 @@ mond 是 Monero 守护进程 `monerod` 的定制换名构建。换名通过 [ini
|
||||
```bash
|
||||
# 本地编译某架构的二进制(输出到 ./output/linux_<arch>/mond)
|
||||
docker buildx build --platform linux/amd64 \
|
||||
--build-arg MONERO_VERSION=v0.18.5.0 \
|
||||
--build-arg MONERO_VERSION="v$(cat VERSION)" \
|
||||
--output type=local,dest=./output \
|
||||
-f docker/Dockerfile .
|
||||
|
||||
# 用已有 tar.gz 打 .deb 包(注意第三个参数是 tar.gz,不是目录)
|
||||
./debian/build-deb.sh amd64 0.18.5.0 mond-amd64-linux-static-0.18.5.0.tar.gz
|
||||
./debian/build-deb.sh amd64 0.18.5.1 mond-amd64-linux-static-0.18.5.1.tar.gz
|
||||
|
||||
# 改 shell 脚本后做静态检查(需自行安装 shellcheck)
|
||||
shellcheck debian/*.sh
|
||||
```
|
||||
|
||||
无单元测试;CI 中唯一的冒烟测试是解包后跑 `mond --version`(musl 纯静态二进制可在 glibc 的 CI runner 直接运行),并用 `ldd` 校验为 `statically linked`(纯静态、无任何动态依赖)。
|
||||
CI 对二进制执行 `mond --version` 和 `mond --help`,用 `ldd` 严格校验为纯静态,并检查 DEB 内的二进制、默认配置和 systemd 服务。
|
||||
|
||||
## Debian 包布局与服务
|
||||
|
||||
|
||||
@@ -1,216 +1,104 @@
|
||||
# Mond
|
||||
|
||||
> Monero daemon 的定制版本
|
||||
Mond 是 [Monero](https://github.com/monero-project/monero) 守护进程 `monerod` 的定制换名构建——Monero 全节点,负责 P2P 同步区块链、提供 RPC。换名(`monero→mond`、`monerod→mond`、`MONERO_*→MOND_*`)由 [init.sh](init.sh) 在构建期对官方源码做 `sed` 改写完成,不维护源码分叉。
|
||||
|
||||
[](LICENSE)
|
||||
[](.gitea/workflows/ci.yaml)
|
||||
**本仓库只包含构建与打包基础设施**,不含 mond 源码:二进制在 CI 中从上游官方仓库 `github.com/monero-project/monero` 编译(init.sh 现场换名),再打包分发到 [gitea.bcde.io](https://gitea.bcde.io) 的 Generic / Debian 包仓库。
|
||||
|
||||
## 🎯 主要特性
|
||||
## 产物
|
||||
|
||||
- 🏗️ **多架构支持** - 原生支持 AMD64 和 ARM64 架构
|
||||
- 📦 **多种安装方式** - 提供 Debian 包和通用二进制包
|
||||
- 🐧 **跨发行版** - musl 纯静态二进制,glibc/musl 任意发行版(Ubuntu/Debian/CentOS/Alpine)直接运行
|
||||
- 🔗 **零依赖** - 所有库(boost/OpenSSL/ZMQ/sodium/unbound 及 libc)全部静态链入,`ldd` 显示 `statically linked`,无任何动态依赖
|
||||
- 🔒 **隐私优先** - 基于 Monero 的隐私保护技术
|
||||
- 🔄 **自动更新** - 通过 Debian 仓库轻松安装和更新
|
||||
每次构建产出单个可执行文件(musl 纯静态,boost/OpenSSL/libzmq/libsodium/unbound/expat 及 libc 全部静态链入,无外部动态库依赖,任意 Linux 发行版可跑):
|
||||
|
||||
## 🚀 快速开始
|
||||
| 二进制 | 作用 |
|
||||
|---|---|
|
||||
| `mond` | Monero 全节点守护进程:P2P 同步区块链、提供 RPC |
|
||||
|
||||
### Debian/Ubuntu(推荐)
|
||||
支持架构 `amd64` / `arm64`;musl 纯静态(static-pie),任意 Linux 发行版(Debian/Ubuntu/Alpine/CentOS 等)开箱即跑。
|
||||
|
||||
## 安装
|
||||
|
||||
### APT(Debian / Ubuntu)
|
||||
|
||||
```bash
|
||||
# 下载 GPG 密钥
|
||||
sudo curl https://gitea.bcde.io/api/packages/wangdefa/debian/repository.key -o /etc/apt/keyrings/gitea-wangdefa.asc
|
||||
|
||||
# 添加仓库
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian stable main" | sudo tee -a /etc/apt/sources.list.d/wangdefa.list
|
||||
|
||||
# 更新并安装
|
||||
sudo apt-get update
|
||||
sudo apt-get install mond
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gitea-wangdefa.asc] https://gitea.bcde.io/api/packages/wangdefa/debian stable main" | sudo tee /etc/apt/sources.list.d/wangdefa.list
|
||||
sudo apt-get update && sudo apt-get install mond
|
||||
```
|
||||
|
||||
### 方式二:通用二进制包
|
||||
安装布局:
|
||||
|
||||
| | 路径 |
|
||||
|---|---|
|
||||
| 二进制 | `/opt/mond/mond` |
|
||||
| 默认配置 | `/opt/mond/params.conf`(postinst 复制到 `/etc/mond/params.conf`) |
|
||||
| 数据 | `/var/lib/mond/data` |
|
||||
| 日志 | `/var/log/mond/` |
|
||||
| 服务 | `mond.service` |
|
||||
|
||||
> 安装后服务**不会自动启动**(首次全节点同步前需确认配置)。按需编辑 `/etc/mond/params.conf`,再启用:
|
||||
>
|
||||
> ```bash
|
||||
> sudo systemctl enable --now mond
|
||||
> ```
|
||||
|
||||
### tar.gz(通用:Alpine / Ubuntu / Debian)
|
||||
|
||||
从 Generic Package Registry 下载对应架构的 tar.gz,解压即用(单二进制):
|
||||
|
||||
```bash
|
||||
# 1. 下载对应架构的包(registry 路径与下载名版本号均不带 v 前缀)
|
||||
wget https://gitea.bcde.io/api/packages/wangdefa/generic/mond/0.18.5.0/mond-amd64-linux-static-0.18.5.0.tar.gz
|
||||
|
||||
# 2. 解压
|
||||
tar -xzf mond-amd64-linux-static-0.18.5.0.tar.gz
|
||||
|
||||
# 3. 运行
|
||||
./mond --help
|
||||
curl -fSL -o mond.tar.gz \
|
||||
https://gitea.bcde.io/api/packages/wangdefa/generic/mond/0.18.5.1/mond-amd64-linux-static-0.18.5.1.tar.gz
|
||||
tar -xzf mond.tar.gz
|
||||
./mond --config-file params.conf # 配置模板见仓库 conf/params.example.conf
|
||||
```
|
||||
|
||||
## 📋 使用说明
|
||||
## 构建与发布
|
||||
|
||||
### Debian/Ubuntu 系统服务
|
||||
Gitea Actions 分为两条流水线:
|
||||
|
||||
#### 启动服务
|
||||
- [.gitea/workflows/ci.yml](.gitea/workflows/ci.yml):分支推送时检查版本、配置和 shell 语法,并在 amd64、arm64 原生 runner 上编译、严格冒烟测试和验证 DEB 包内容。
|
||||
- [.gitea/workflows/release.yml](.gitea/workflows/release.yml):tag 推送时构建 tar.gz 和 DEB,生成 `SHA256SUMS`,上传包仓库并创建或更新 Release。
|
||||
|
||||
musl 纯静态在 `alpine:3.23` 下手编 5 个静态库(OpenSSL 3.0.21、libsodium 1.0.20、libzmq 4.3.5、expat 2.6.4、unbound 1.25.1)并 patch monero CMakeLists(去 `-pie`、Linux `STATIC_FLAGS` 改真 `-static`),产出 static-pie 零依赖二进制。换名 + patch 逻辑见 [init.sh](init.sh)。
|
||||
|
||||
本地构建:
|
||||
|
||||
```bash
|
||||
# 启用并启动服务
|
||||
sudo systemctl enable mond.service
|
||||
sudo systemctl start mond.service
|
||||
|
||||
# 查看状态
|
||||
sudo systemctl status mond.service
|
||||
|
||||
# 查看日志
|
||||
sudo journalctl -u mond -f
|
||||
```
|
||||
|
||||
#### 停止服务
|
||||
|
||||
```bash
|
||||
sudo systemctl stop mond.service
|
||||
sudo systemctl disable mond.service
|
||||
```
|
||||
|
||||
### 直接运行
|
||||
|
||||
```bash
|
||||
# 基本运行
|
||||
./mond
|
||||
|
||||
# 指定数据目录
|
||||
./mond --data-dir=/path/to/data
|
||||
|
||||
# 指定日志文件
|
||||
./mond --log-file=/path/to/log
|
||||
|
||||
# 后台运行
|
||||
./mond --detach
|
||||
```
|
||||
|
||||
## ⚙️ 配置说明
|
||||
|
||||
### 目录结构
|
||||
|
||||
#### Debian/Ubuntu 系统包
|
||||
|
||||
```
|
||||
/opt/mond/mond # 二进制文件
|
||||
/etc/mond/params.conf # 配置文件
|
||||
/var/lib/mond/data/ # 区块链数据目录
|
||||
/var/log/mond/ # 日志目录
|
||||
```
|
||||
|
||||
### 修改配置
|
||||
|
||||
Debian/Ubuntu 系统包使用配置文件方式运行,修改配置非常简单:
|
||||
|
||||
```bash
|
||||
# 1. 编辑配置文件
|
||||
sudo nano /etc/mond/params.conf
|
||||
|
||||
# 2. 重启服务使配置生效
|
||||
sudo systemctl restart mond.service
|
||||
```
|
||||
|
||||
**优势**:配置文件在升级时不会被覆盖,您的自定义设置会被保留。
|
||||
|
||||
#### 通用二进制包
|
||||
|
||||
```
|
||||
./mond # 二进制文件
|
||||
```
|
||||
|
||||
### 常用命令行选项
|
||||
|
||||
```bash
|
||||
--data-dir <path> # 指定数据目录
|
||||
--log-file <path> # 指定日志文件路径
|
||||
--log-level <level> # 日志级别 (0-4)
|
||||
--detach # 后台运行
|
||||
--rpc-bind-ip <ip> # RPC 绑定 IP (默认: 127.0.0.1)
|
||||
--rpc-bind-port <port> # RPC 绑定端口 (默认: 18081)
|
||||
--p2p-bind-ip <ip> # P2P 绑定 IP (默认: 0.0.0.0)
|
||||
--p2p-bind-port <port> # P2P 绑定端口 (默认: 18080)
|
||||
```
|
||||
|
||||
## 🔄 修改内容
|
||||
|
||||
本项目基于 [Monero](https://github.com/monero-project/monero) 进行以下修改:
|
||||
|
||||
1. **项目重命名**:`monero` → `mond`
|
||||
2. **二进制文件名**:`monerod` → `mond`
|
||||
3. **版本标识**:`MONERO_*` → `MOND_*`
|
||||
|
||||
所有修改通过 [init.sh](init.sh) 在构建过程中自动应用。
|
||||
|
||||
## 🏗️ 构建说明
|
||||
|
||||
### Docker 构建(推荐)
|
||||
|
||||
本项目使用 Docker + Alpine/musl 构建:手动源码编译 5 个静态库(OpenSSL/libsodium/libzmq/expat/unbound)并 patch monero CMakeLists,产出 static-pie 纯静态二进制(零外部依赖、跨发行版)。
|
||||
|
||||
#### 构建多架构二进制文件
|
||||
|
||||
```bash
|
||||
# 构建 amd64 和 arm64 架构
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
-f docker/Dockerfile \
|
||||
--output type=local,dest=./output .
|
||||
```
|
||||
|
||||
#### 构建单一架构
|
||||
|
||||
```bash
|
||||
# 仅构建 amd64
|
||||
# 编译某架构二进制(输出到 ./output/linux_<arch>/mond)
|
||||
docker buildx build --platform linux/amd64 \
|
||||
-f docker/Dockerfile \
|
||||
--output type=local,dest=./output .
|
||||
--build-arg MONERO_VERSION="v$(cat VERSION)" \
|
||||
--output type=local,dest=./output \
|
||||
-f docker/Dockerfile .
|
||||
|
||||
# 仅构建 arm64
|
||||
docker buildx build --platform linux/arm64 \
|
||||
-f docker/Dockerfile \
|
||||
--output type=local,dest=./output .
|
||||
```
|
||||
|
||||
#### 验证依赖
|
||||
|
||||
```bash
|
||||
# 纯静态校验:应输出 "statically linked"(零外部依赖,可在 glibc/musl 任意发行版运行)
|
||||
# 校验纯静态(应输出 "statically linked")
|
||||
ldd output/linux_amd64/mond
|
||||
# 预期: statically linked
|
||||
|
||||
# 用产物 tar.gz 打 .deb
|
||||
./debian/build-deb.sh amd64 0.18.5.1 mond-amd64-linux-static-0.18.5.1.tar.gz
|
||||
```
|
||||
|
||||
### 本地构建
|
||||
## 版本号约定
|
||||
|
||||
纯静态构建需在 Alpine 下手编 5 个静态库(OpenSSL/libsodium/libzmq/expat/unbound)并 patch monero CMakeLists,步骤已固化在 [docker/Dockerfile](docker/Dockerfile)——**直接用上面的 Docker 构建即可**,无需手动复现。换名 + patch 逻辑见 [init.sh](init.sh)。
|
||||
- 根目录 [VERSION](VERSION) 是唯一版本来源,使用不带 `v` 的四段版本号。
|
||||
- **上游源码 git tag** 带 `v`(如 `v0.18.5.1`),CI 构建时自动补回。
|
||||
- **包版本**(tar.gz / deb / registry 路径)一律用数字(如 `0.18.5.1`),符合 Debian 版本规范。
|
||||
- 发布 tag 可写成 `0.18.5.1` 或 `v0.18.5.1`,去掉 `v` 后必须与 VERSION 一致。
|
||||
|
||||
### 构建环境要求
|
||||
发版时先更新 VERSION 并提交,再创建同版本 tag。
|
||||
|
||||
- **构建镜像**: `alpine:3.23`(Dockerfile 内置,无需本机安装)
|
||||
- **CPU**: 多核 CPU(`make daemon` 约 7 分钟/架构,5 库命中缓存后)
|
||||
- **内存**: 至少 4GB RAM
|
||||
- **磁盘**: 至少 10GB 可用空间
|
||||
- **Docker**: 需安装 Docker 和 buildx
|
||||
## 修改内容
|
||||
|
||||
## 📝 许可证
|
||||
基于 [Monero](https://github.com/monero-project/monero)(BSD-3-Clause),由 [init.sh](init.sh) 在构建期自动应用,不维护源码分叉:
|
||||
|
||||
本项目基于 BSD-3-Clause 许可证开源。
|
||||
- 项目名 `monero` → `mond`
|
||||
- 二进制 `monerod` → `mond`
|
||||
- 版本宏 `MONERO_*` → `MOND_*`
|
||||
|
||||
- 原始项目:[Monero](https://github.com/monero-project/monero) (BSD-3-Clause)
|
||||
- 修改内容:详见 [init.sh](init.sh)
|
||||
## 目录结构
|
||||
|
||||
## 🙏 致谢
|
||||
|
||||
- [Monero Project](https://github.com/monero-project/monero) - 原始项目和核心技术
|
||||
|
||||
## ⚠️ 免责声明
|
||||
|
||||
本软件仅供学习和研究使用。使用本软件进行任何活动请遵守当地法律法规。作者不对使用本软件造成的任何损失或法律问题负责。
|
||||
|
||||
## 📞 支持
|
||||
|
||||
如有问题或建议,请通过以下方式联系:
|
||||
|
||||
- 提交 Issue
|
||||
- 发送 Pull Request
|
||||
|
||||
---
|
||||
|
||||
**注意**:本项目是 Monero 的定制版本,不代表官方 Monero 项目。
|
||||
```
|
||||
.gitea/workflows/ CI 流水线
|
||||
docker/ Dockerfile(musl 纯静态,从上游官方源码编译 + init.sh 换名)
|
||||
debian/ .deb 打包:control 模板、维护脚本、systemd 服务
|
||||
conf/ params.example.conf 默认配置模板
|
||||
init.sh 构建期换名 + 静态 patch 脚本
|
||||
```
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ set -e
|
||||
# 参数检查
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>"
|
||||
echo "Example: $0 amd64 0.18.5.0 mond-amd64-linux-static-0.18.5.0.tar.gz"
|
||||
echo "Example: $0 amd64 0.18.5.1 mond-amd64-linux-static-0.18.5.1.tar.gz"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
+8
-8
@@ -10,12 +10,12 @@ RUN apk add --no-cache g++ gcc make cmake git linux-headers autoconf automake li
|
||||
ENV CFLAGS="-fPIC -O2" CXXFLAGS="-fPIC -O2"
|
||||
WORKDIR /deps
|
||||
|
||||
# OpenSSL 3.0.16(Alpine 仓库只有 .so,须源码编静态)
|
||||
RUN wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.16/openssl-3.0.16.tar.gz && \
|
||||
tar xf openssl-3.0.16.tar.gz && cd openssl-3.0.16 && \
|
||||
# OpenSSL 3.0.21(与 Monero v0.18.5.1 depends 对齐;Alpine 仓库只有 .so,须源码编静态)
|
||||
RUN wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.21/openssl-3.0.21.tar.gz && \
|
||||
tar xf openssl-3.0.21.tar.gz && cd openssl-3.0.21 && \
|
||||
if [ "$(uname -m)" = aarch64 ]; then OSSL_T=linux-aarch64; else OSSL_T=linux-x86_64; fi && \
|
||||
./Configure no-shared no-tests --prefix=/usr --libdir=lib $OSSL_T && \
|
||||
make -j"$(nproc)" && make install_sw && cd / && rm -rf /deps/openssl-3.0.16*
|
||||
make -j"$(nproc)" && make install_sw && cd / && rm -rf /deps/openssl-3.0.21*
|
||||
|
||||
# libsodium 1.0.20
|
||||
RUN wget -q https://download.libsodium.org/libsodium/releases/libsodium-1.0.20.tar.gz && \
|
||||
@@ -35,9 +35,9 @@ RUN wget -q https://github.com/libexpat/libexpat/releases/download/R_2_6_4/expat
|
||||
./configure --enable-static --disable-shared --prefix=/usr && \
|
||||
make -j"$(nproc)" && make install && cd / && rm -rf /deps/expat-2.6.4*
|
||||
|
||||
# unbound 1.22.0(DNSSEC;release archive 需 flex/bison 现生成 lexer)
|
||||
RUN wget -q https://github.com/NLnetLabs/unbound/archive/refs/tags/release-1.22.0.tar.gz -O unbound.tar.gz && \
|
||||
tar xf unbound.tar.gz && cd unbound-release-1.22.0 && \
|
||||
# unbound 1.25.1(DNSSEC,与 Monero v0.18.5.1 depends 对齐)
|
||||
RUN wget -q https://www.nlnetlabs.nl/downloads/unbound/unbound-1.25.1.tar.gz && \
|
||||
tar xf unbound-1.25.1.tar.gz && cd unbound-1.25.1 && \
|
||||
./configure --disable-shared --enable-static --prefix=/usr --with-libexpat=/usr --with-ssl=/usr \
|
||||
--with-libevent=no --without-pythonmodule --without-pyunbound --with-libunbound-only --with-pic && \
|
||||
make -j"$(nproc)" && make install && cd / && rm -rf /deps/unbound*
|
||||
@@ -60,7 +60,7 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then MARCH=armv8-a; MTAG=linux-armv8; \
|
||||
make -j"$(nproc)" -C build/release daemon && \
|
||||
mkdir -p /output && cp build/release/bin/mond /output/mond
|
||||
|
||||
# ---- Stage 3: 导出(保持 ci.yaml 期望的 linux_<arch>/mond 布局)----
|
||||
# ---- Stage 3: 导出(保持 CI 期望的 linux_<arch>/mond 布局)----
|
||||
FROM scratch
|
||||
ARG TARGETARCH
|
||||
COPY --from=build /output/mond /linux_${TARGETARCH}/mond
|
||||
|
||||
@@ -1,4 +1,22 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
require_pattern() {
|
||||
pattern=$1
|
||||
file=$2
|
||||
grep -Fq -- "$pattern" "$file" || {
|
||||
echo "Required patch anchor not found in $file: $pattern" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
require_pattern 'project(monero)' CMakeLists.txt
|
||||
require_pattern 'OUTPUT_NAME "monerod"' src/daemon/CMakeLists.txt
|
||||
require_pattern '${monero_SOURCE_DIR}' cmake/CheckLinkerFlag.cmake
|
||||
require_pattern 'DEF_MONERO_VERSION' src/version.cpp.in
|
||||
require_pattern 'DEF_MONERO_RELEASE_NAME "Fluorine Fermi"' src/version.cpp.in
|
||||
require_pattern 'add_linker_flag_if_supported("-pie" LD_SECURITY_FLAGS)' CMakeLists.txt
|
||||
require_pattern 'set(STATIC_FLAGS "-static-libgcc -static-libstdc++")' CMakeLists.txt
|
||||
|
||||
# Modify the CMakeLists.txt and source files to change the project name from "monero" to "mond"
|
||||
|
||||
@@ -57,6 +75,12 @@ sed -i 's|add_linker_flag_if_supported("-pie" LD_SECURITY_FLAGS)|# -pie removed
|
||||
# Linux STATIC_FLAGS 从 -static-libgcc/-static-libstdc++ 改真 -static
|
||||
sed -i 's|set(STATIC_FLAGS "-static-libgcc -static-libstdc++")|set(STATIC_FLAGS "-static")|' CMakeLists.txt
|
||||
|
||||
require_pattern 'project(mond)' CMakeLists.txt
|
||||
require_pattern 'OUTPUT_NAME "mond"' src/daemon/CMakeLists.txt
|
||||
require_pattern 'DEF_MOND_VERSION' src/version.cpp.in
|
||||
require_pattern '# -pie removed for fully-static' CMakeLists.txt
|
||||
require_pattern 'set(STATIC_FLAGS "-static")' CMakeLists.txt
|
||||
|
||||
echo "Project successfully modified from Monero to Mond!"
|
||||
echo "Binary output name: mond"
|
||||
echo "Project name: mond"
|
||||
|
||||
Reference in New Issue
Block a user