• 主页
  • 归档
  • 软件
所有文章 友情链接 关于我

  • 主页
  • 归档
  • 软件

本地搭建第三方alpine repo

2024-03-22

警告: 本文章可能会出现部分没说清楚的地方,欢迎补充。

准备工作

  • 一个 alpine 容器
  • 一双手

安装依赖

1
$ sudo apk add abuild

编写 APKBUILD

一个简单的 APKBUILD 示例:

APKBUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Maintainer: username <username@mail.com>
pkgname=project
pkgver=x.x.x
pkgrel=x
pkgdesc=""
url="https://github.com/username/project"
arch="aarch64"
_carch="arm64"
license="Apache-2.0"
makedepends="
bash
go
...
"

# Source
source="
v0.56.0.tar.gz::https://github.com/username/project/archive/refs/tags/v0.56.0.tar.gz"

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
./configure --prefix="$pkgdir"
}

build() {
make
}

package() {
make install
}


sha512sums="
"

一些常见的选项解释:

  • pkgname 软件包名称
  • pkgver 软件包版本
  • pkgrel 软件的附加版本,例如这里的 lzip (1.24.1-r0):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
user@localhost ~/a/s/frp (main)> sudo apk add abuild
fetch https://mirrors.bfsu.edu.cn/alpine/edge/main/aarch64/APKINDEX.tar.gz
fetch https://mirrors.bfsu.edu.cn/alpine/edge/community/aarch64/APKINDEX.tar.gz
(1/9) Installing attr (2.5.2-r0)
(2/9) Installing libcap-getcap (2.69-r1)
(3/9) Installing fakeroot (1.33-r0)
(4/9) Installing lzip (1.24.1-r0)
(5/9) Installing openssl (3.2.1-r0)
(6/9) Installing patch (2.7.6-r10)
(7/9) Installing pkgconf (2.1.1-r0)
(8/9) Installing abuild (3.12.0-r5)
Executing abuild-3.12.0-r5.pre-install
(9/9) Installing abuild-sudo (3.12.0-r5)
Executing busybox-1.36.1-r19.trigger
OK: 164 MiB in 103 packages
  • pkgdesc 软件包描述
  • url 项目网址,可以贴github项目
  • arch 目标架构,可以通过查看软件源得知
  • license 软件许可
  • makedepends 构建所需依赖
  • source 软件源码获取,只支持.tar.gz格式,例如:
1
2
source="
xxx.tar.gz::<源码下载url>"
  • builddir 编译软件包的目录,例如如果要在xxx文件夹下编译就写xxx
  • prepare函数 可以填写在编译前的一些前置依赖构建,例如
1
2
3
prepare() {
go mod download
}

这样就可以在准备阶段下载go软件包

  • build函数 一般填写编译指令,例如 make
  • install函数 一般填写安装指令,例如 make install
  • sh512sums 使用 abuild checksum自动填充:
1
2
3
4
5
6
7
user@localhost ~/a/s/frp (main)> abuild checksum
>>> frp: Fetching v0.56.0.tar.gz::https://github.com/fatedier/frp/archive/refs/tags/v0.56.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1054k 0 1054k 0 0 467k 0 --:--:-- 0:00:02 --:--:-- 1291k
>>> frp: Updating the sha512sums in /home/user/alpine-software-repos/source/frp/APKBUILD...

当然也可以编写例如post-install脚本来在安装后进行一些初始化功能。

一些常见变量的解释

  • $srcdir 一般为自动设定
  • $pkgname APKBUILD 中设定的软件包名
  • $pkgver APKBUILD 中设定的软件包版本

构建

执行

1
abuild -r

构建的软件包在用户文件夹下的package文件夹
下面是一个详细的构建流程,以构建frp为例:

logcat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
user@localhost ~/a/s/frp (main)> sudo abuild -r -f -F
>>> frp: Building source/frp 0.56.0-r0 (using abuild 3.12.0-r5) started Sat, 23 Mar 2024 23:38:40 +0800
>>> frp: Checking sanity of /home/user/alpine-software-repos/source/frp/APKBUILD...
>>> frp: Analyzing dependencies...
>>> frp: Installing for build: build-base bash go wget
WARNING: opening /root/packages//source: No such file or directory
(1/18) Installing jansson (2.14-r4)
(2/18) Installing zstd-libs (1.5.5-r9)
(3/18) Installing binutils (2.42-r0)
(4/18) Installing libgomp (13.2.1_git20240309-r0)
(5/18) Installing libatomic (13.2.1_git20240309-r0)
(6/18) Installing gmp (6.3.0-r0)
(7/18) Installing isl26 (0.26-r1)
(8/18) Installing mpfr4 (4.2.1-r0)
(9/18) Installing mpc1 (1.3.1-r1)
(10/18) Installing gcc (13.2.1_git20240309-r0)
(11/18) Installing libstdc++-dev (13.2.1_git20240309-r0)
(12/18) Installing musl-dev (1.2.5-r0)
(13/18) Installing g++ (13.2.1_git20240309-r0)
(14/18) Installing fortify-headers (1.1-r3)
(15/18) Installing build-base (0.5-r3)
(16/18) Installing binutils-gold (2.42-r0)
(17/18) Installing go (1.22.1-r1)
(18/18) Installing .makedepends-frp (20240323.153842)
Executing busybox-1.36.1-r19.trigger
OK: 542 MiB in 121 packages
>>> frp: Cleaning up srcdir
>>> frp: Cleaning up pkgdir
>>> frp: Cleaning up tmpdir
>>> frp: Fetching v0.56.0.tar.gz::https://github.com/fatedier/frp/archive/refs/tags/v0.56.0.tar.gz
>>> frp: Fetching v0.56.0.tar.gz::https://github.com/fatedier/frp/archive/refs/tags/v0.56.0.tar.gz
>>> frp: Checking sha512sums...
v0.56.0.tar.gz: OK
>>> frp: Unpacking /var/cache/distfiles/v0.56.0.tar.gz...
go fmt ./...
env CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -tags frps -o bin/frps ./cmd/frps
go version go1.22.1 linux/arm64
env CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -tags frpc -o bin/frpc ./cmd/frpc
>>> WARNING: frp: APKBUILD does not run any tests!
Alpine policy will soon require that packages have any relevant testsuites run during the build process.
To fix, either define a check() function, or declare !check in $options to indicate the package does not have a testsuite.
mkdir: created directory '/home/user/alpine-software-repos/source/frp/pkg/frp/etc'
mkdir: created directory '/home/user/alpine-software-repos/source/frp/pkg/frp/etc/frp'
--2024-03-23 23:39:49-- https://github.com/fatedier/frp/raw/dev/conf/frpc_full_example.toml
Resolving github.com (github.com)... 28.0.0.144
Connecting to github.com (github.com)|28.0.0.144|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/fatedier/frp/dev/conf/frpc_full_example.toml [following]
--2024-03-23 23:39:52-- https://raw.githubusercontent.com/fatedier/frp/dev/conf/frpc_full_example.toml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 28.0.2.190
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|28.0.2.190|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12411 (12K) [text/plain]
Saving to: '/home/user/alpine-software-repos/source/frp/pkg/frp/etc/frp/frpc.toml'

/home/user/alpine-r 100%[===============================>] 12.12K --.-KB/s in 0.002s

2024-03-23 23:39:54 (7.84 MB/s) - '/home/user/alpine-software-repos/source/frp/pkg/frp/etc/frp/frpc.toml' saved [12411/12411]

--2024-03-23 23:39:54-- https://github.com/fatedier/frp/raw/dev/conf/frps_full_example.toml
Resolving github.com (github.com)... 28.0.0.144
Connecting to github.com (github.com)|28.0.0.144|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/fatedier/frp/dev/conf/frps_full_example.toml [following]
--2024-03-23 23:39:58-- https://raw.githubusercontent.com/fatedier/frp/dev/conf/frps_full_example.toml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 28.0.2.190
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|28.0.2.190|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6162 (6.0K) [text/plain]
Saving to: '/home/user/alpine-software-repos/source/frp/pkg/frp/etc/frp/frps.toml'

/home/user/alpine-r 100%[===============================>] 6.02K --.-KB/s in 0.001s

2024-03-23 23:40:01 (7.36 MB/s) - '/home/user/alpine-software-repos/source/frp/pkg/frp/etc/frp/frps.toml' saved [6162/6162]

>>> frp: Running postcheck for frp
>>> frp: Preparing package frp...
>>> frp: Stripping binaries
>>> frp: Scanning shared objects
>>> frp: Tracing dependencies...
>>> frp: Package size: 31.8 MB
>>> frp: Compressing data...
>>> frp: Create checksum...
>>> frp: Create frp-0.56.0-r0.apk
>>> frp: Build complete at Sat, 23 Mar 2024 23:40:08 +0800 elapsed time 0h 1m 28s
>>> frp: Cleaning up srcdir
>>> frp: Cleaning up pkgdir
>>> frp: Uninstalling dependencies...
(1/18) Purging .makedepends-frp (20240323.153842)
(2/18) Purging build-base (0.5-r3)
(3/18) Purging g++ (13.2.1_git20240309-r0)
(4/18) Purging libstdc++-dev (13.2.1_git20240309-r0)
(5/18) Purging gcc (13.2.1_git20240309-r0)
(6/18) Purging binutils (2.42-r0)
(7/18) Purging libatomic (13.2.1_git20240309-r0)
(8/18) Purging libgomp (13.2.1_git20240309-r0)
(9/18) Purging fortify-headers (1.1-r3)
(10/18) Purging go (1.22.1-r1)
(11/18) Purging binutils-gold (2.42-r0)
(12/18) Purging isl26 (0.26-r1)
(13/18) Purging jansson (2.14-r4)
(14/18) Purging mpc1 (1.3.1-r1)
(15/18) Purging mpfr4 (4.2.1-r0)
(16/18) Purging musl-dev (1.2.5-r0)
(17/18) Purging zstd-libs (1.5.5-r9)
(18/18) Purging gmp (6.3.0-r0)
Executing busybox-1.36.1-r19.trigger
OK: 164 MiB in 103 packages
>>> frp: Updating the source/aarch64 repository index...
>>> frp: Signing the index...

搭建软件源

创建文件夹

1
$ mkdir -p /var/www/root/alpine

初始化新的APK仓库

1
apk index -o APKINDEX.tar.gz /var/www/root/alpine/*.apk

开启nginx

1
nginx -s reload


-------------本文结束感谢您的阅读-------------



  • linux
  • alpine
  • 软件源

扫一扫,分享到微信

微信分享二维码
PostmarketOS移植常见问题
折腾ts action遇到的其中一个问题
  1. 1. 准备工作
  2. 2. 安装依赖
  3. 3. 编写 APKBUILD
    1. 3.1. 一些常见变量的解释
  4. 4. 构建
  5. 5. 搭建软件源

预览:

0  字
评论
  • Latest
  • Oldest
  • Hottest
评论区空空荡荡,客官快来评论吧~
Powered by Waline v2.15.8
© 2025 dpkg123
本站已苟活 2 年 52 天 21 小时 50 分钟 18 秒
Hexo Theme Yilia by Litten
萌ICP备20231955号
  • 所有文章
  • 友情链接
  • 关于我

tag:

  • 3DS
  • linux
  • buildroot
  • kernel
  • android
  • dtb
  • dtc
  • OPPO
  • hexo
  • web前端
  • github
  • shell
  • 刷机工具
  • 二次元
  • 刷机
  • debian
  • 手机
  • Android
  • Root
  • Github
  • CI
  • Linux
  • 虚拟化 Android
  • twrp
  • build
  • 归档
  • 番剧
  • 别当欧尼酱了
  • 哔哩哔哩
  • av10492
  • 猎奇
  • 内核
  • 编译
  • 速通
  • 教程
  • 奇技淫巧
  • TypeScript
  • Github Actions
  • 杂谈
  • 网页搭建
  • 联发科
  • KernelSU
  • kvm
  • android kernel
  • gki
  • alpine
  • 软件源
  • vps
  • 网页加速
  • fastboot
  • PostmarketOS
  • ROM移植
  • kernelSU
  • 移植
  • 内核编译
  • Kernel
  • miui
  • coloros
  • makefile
  • 9008

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • 关于高通gunyah虚拟化的一些研究

    2025-03-03

    #虚拟化 Android

  • 安卓内核编译速通

    2025-02-13

    #Android#内核#编译#速通#教程#奇技淫巧

  • 使用github工作流全自动构建postmarketos刷机包

    2025-02-13

    #刷机#手机#Android#Root#Github#CI#Linux

  • PostmarketOS移植常见问题

    2024-08-12

    #linux#android#刷机#PostmarketOS#ROM移植

  • 本地搭建第三方alpine repo

    2024-03-22

    #linux#alpine#软件源

  • 折腾ts action遇到的其中一个问题

    2024-02-11

    #TypeScript#Github Actions

  • dtc编译教程

    2024-01-29

    #linux#android#dtb#dtc

  • OPPO Reno6 ColorOS13.1内核源码编译记录

    2024-01-15

    #kernel#android#OPPO

  • Android boot.img 文件的解包、修改与重打包小记

    2023-12-24

    #linux#android

  • twrp设备树从入门到放弃

    2023-12-10

    #linux#android#twrp#build

  • 3DS折腾linux小记

    2023-10-06

    #3DS#linux#buildroot#kernel

  • 暂停更新博客通知

    2023-08-08

    #杂谈

  • Makefile入门

    2023-08-04

    #linux#makefile

  • linux电脑给手机进行9008刷机

    2023-07-28

    #linux#刷机#9008

  • 浅谈安卓内核的碎片化

    2023-07-19

    #kernel#android#android kernel#gki

  • 哔哩哔哩危险地带部分补档

    2023-06-28

    #哔哩哔哩#av10492#猎奇

  • 使用dh_make快速构建deb

    2023-06-22

    #linux#debian

  • linux解压payload.bin和转换system.new.dat.br

    2023-06-18

    #linux#android#刷机

  • 浅谈联发科设备玩机的可能性

    2023-05-15

    #刷机#联发科#KernelSU#kvm

  • 给OPPO Reno6移植kernelSU

    2023-05-10

    #linux#kernelSU#移植#内核编译#Kernel

  • 别当欧尼酱了12集归档

    2023-05-02

    #归档#番剧#别当欧尼酱了

  • 珍爱生命,远离小众云

    2023-05-01

    #vps

  • fdt转dtb

    2023-04-30

    #android#dtb

  • coloros和miui

    2023-04-30

    #android#手机#miui#coloros

  • linux刷机工具箱

    2023-04-29

    #linux#shell#刷机工具

  • 简单写一个shell刷机脚本之进阶篇

    2023-04-29

    #linux#shell#刷机#fastboot

  • 简单写一个shell刷机脚本

    2023-04-29

    #linux#shell#刷机

  • linux娘

    2023-04-12

    #linux#二次元

  • 使用netlify加快博客访问速度

    2023-04-12

    #hexo#github#网页加速

  • hexo博客源码备份

    2023-04-10

    #hexo#web前端#github

  • 新博客

    2023-04-10

    #hexo#网页搭建

  • Hello World

    1970-01-01

  • note现在暂不考虑申请新的友链
  • 图床
  • 留言板
  • 原来的博客
  • Adminzhangの个人博客
  • cyp0633的blog
  • 小码同学
  • U.M.R-Powered-Blog
  • 秋澪Akimio
  • ialtone的小站
  • PiCpo的阁楼
  • artiga033
  • 柏园猫のBlog
  • 欠陥電気の摸鱼小池
  • 洛仙璃の幻梦
  • 木屐落在水洼了
  • 湛蓝的调色板
  • SakuraKooi的Blog
  • 新世界的大门
  • 沨鸾的小窝
  • Revincx
  • JIPA233の小窝
  • Mufanc
  • Fika
  • Pinpe的物语
  • 残夜的小博客
透明小菜鸡一枚<br><br>目前正在学习C++和C<br>正在移植postmarketOS到k30pro上<br>本博客使用github-page作为网页托管平台,netlify提供cdn加速服务。<br>不知道为啥yilia主题改不了下面的文字。<br>总之欢迎来到这里!