Skip to content

Commit

Permalink
Update cross compile
Browse files Browse the repository at this point in the history
  • Loading branch information
elysia-best committed Mar 10, 2024
1 parent cba490b commit d6595b5
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 45 deletions.
54 changes: 9 additions & 45 deletions .github/workflows/build-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,19 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free up spaces
run: |
echo "=============================================================================="
echo "Freeing up disk space on CI system"
echo "=============================================================================="
echo "Listing 100 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
echo "Removing large packages"
sudo apt-get remove -y '^ghc-*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell monodoc-http mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
rm -rf /usr/share/dotnet/
rm -rf /opt/hostedtoolcache
df -h
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 4096
swap-size-mb: 512
remove-dotnet: 'true'
remove-android: 'true'


container: docker.io/library/debian:trixie-slim
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Add arm64 architecture
run: |
dpkg --add-architecture arm64
- uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest
use_systemd_nspawn: true
bind_mount_repository: true
image_additional_mb: 10240
commands: |
apt-get update -y
apt-get upgrade -y
apt-get install -y equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++
echo 29 | bash build-github.sh
- name: Run a build script
run: |
dpkg --add-architecture armhf
echo 29 | bash build-github-cross-compile.sh
- name: Zip built files
run: tar -zcvf BuiltDeb.tar.gz ./LingmoSrcBuild/Deb
Expand Down
116 changes: 116 additions & 0 deletions build-github-cross-compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash
shopt -s extglob
set -e
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
source_dir=$script_dir/LingmoSrcBuild/Src
deb_dir=$script_dir/LingmoSrcBuild/Deb

echo '欢迎使用灵墨OS自动编译脚本!'
echo '提示: 使用前请确认已经安装了所有必要的依赖。'

if test -e $source_dir
then
echo '存在同名的LingmoOS源文件夹,正在删除...'
rm -rf $source_dir
fi
echo '创建新的LingmoOS源文件夹...'
mkdir -p $source_dir

if test -e $deb_dir
then
echo '存在同名的LingmoOS输出文件夹,正在删除...'
rm -rf $deb_dir
fi
echo '创建新的LingmoOS输出文件夹...'
mkdir -p $deb_dir

function InstallDepends() {
echo '开始安装依赖'
apt-get --yes install git devscripts equivs crossbuild-essential-arm64
rm -rfv LingmoOSBuildDeps
git clone https://github.com/LingmoOS/LingmoOSBuildDeps.git
cd LingmoOSBuildDeps
mk-build-deps -i -t "apt-get -y" -r > /dev/null
}

# 定义一个函数来编译项目
function Compile() {
repo_name=$1
echo "开始编译 $repo_name ..."
cd $source_dir
if test -d $repo_name; then
echo "已存在 $repo_name 目录,更新中..."
cd $repo_name && git reset --hard HEAD && git pull
else
echo "正在克隆 $repo_name ..."
git clone https://github.com/LingmoOS/$repo_name.git
cd $repo_name
fi
echo "正在安装 $repo_name 依赖..."
# 在这里添加项目的依赖安装代码
mk-build-deps -i -t "apt-get --yes" -r
echo "构建 $repo_name ..."
dpkg-buildpackage -b -uc -us -tc --host-arch arm64 -j$(nproc)
# 在这里添加项目构建和编译命令
echo "$repo_name 编译完成"

# lingmo-kwin 需要安装
if [ "$repo_name" = "lingmo-kwin" ]; then
echo "安装 lingmo-kwin"
apt install -y --no-install-recommends $source_dir/!(*dbgsym*).deb
fi

echo "复制 $repo_name 的安装包"
cd $source_dir
mv -v !(*dbgsym*).deb $deb_dir/
}
REPOS="lingmo-kwin lingmo-screenlocker lingmo-settings lingmo-screenshots lingmo-cursor-themes lingmo-sddm-theme lingmo-appmotor lingmo-neofetch lingmo-daemon lingmo-ocr lingmo-terminal lingmo-gtk-themes LingmoUI lingmo-systemicons lingmo-wallpapers lingmo-debinstaller lingmo-calculator lingmo-windows-plugins lingmo-launcher lingmo-statusbar lingmo-qt-plugins lingmo-dock liblingmo lingmo-filemanager lingmo-core lingmo-texteditor lingmo-kwin-plugins lingmo-videoplayer"

# 先安装依赖
InstallDepends

# 列出所有项目供用户选择
select project in \
lingmo-kwin \
lingmo-screenlocker \
lingmo-settings \
lingmo-screenshots \
lingmo-cursor-themes \
lingmo-sddm-theme \
lingmo-appmotor \
lingmo-neofetch \
lingmo-daemon \
lingmo-ocr \
lingmo-terminal \
lingmo-gtk-themes \
LingmoUI \
lingmo-systemicons \
lingmo-wallpapers \
lingmo-debinstaller \
lingmo-calculator \
lingmo-windows-plugins \
lingmo-launcher \
lingmo-statusbar \
lingmo-qt-plugins \
lingmo-dock \
liblingmo \
lingmo-filemanager \
lingmo-core \
lingmo-texteditor \
lingmo-kwin-plugins \
lingmo-videoplayer \
all \
quit

do
if [[ $project == "all" ]]; then
for repo in $REPOS; do
Compile $repo
done
exit 0
elif [[ $project == "quit" ]]; then
break
else
Compile $project
fi
done

0 comments on commit d6595b5

Please sign in to comment.