Skip to content

Commit

Permalink
Add aarch64 support and simplify the Makefile (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Nov 14, 2022
1 parent 8916772 commit fb7591d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 89 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ jobs:
run: sudo rm -rf "/usr/local/share/boost" "$AGENT_TOOLSDIRECTORY"
- name: Install prerequisites
run: sudo apt install make curl zip unzip check -qq
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build
run: make
run: |
sudo make
- name: Upload artifacts
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
artifacts="-a ./VoidGlibc.zip -a ./VoidMusl.zip"
artifacts="-a ./void-x86_64.zip -a ./void-x86_64-musl.zip -a ./void-aarch64.zip -a void-aarch64-musl.zip"
tag_name="${GITHUB_REF#refs/tags/}"
hub release create $artifacts -m "$tag_name" "$tag_name"
env:
Expand Down
114 changes: 27 additions & 87 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,104 +1,44 @@
DLR=curl
DLR_FLAGS=-L

VOID_REVISION=20221001
BASE_URL=https://repo-default.voidlinux.org/live/$(VOID_REVISION)
VOID_GLIBC_ROOTFS=void-x86_64-ROOTFS-$(VOID_REVISION).tar.xz
VOID_MUSL_ROOTFS=void-x86_64-musl-ROOTFS-$(VOID_REVISION).tar.xz
VOID_GLIBC_URL=$(BASE_URL)/$(VOID_GLIBC_ROOTFS)
VOID_MUSL_URL=$(BASE_URL)/$(VOID_MUSL_ROOTFS)

LNCR_ZIP_URL=https://github.com/yuk7/wsldl/releases/download/22020900/icons.zip
LNCR_ZIP_EXE=Void.exe

define prepare-rootfs =
@echo -e '\e[1;31mPreparing $@...\e[m'
mkdir $@
sudo tar -xpf $< -C $@
sudo cp -f /etc/resolv.conf $@/etc/resolv.conf
sudo chroot $@ /sbin/xbps-install --sync --update --yes
sudo rm -rf `sudo find $@/var/cache/xbps/ -type f`
sudo rm $@/etc/resolv.conf
sudo chmod +x $@
endef

define pack-rootfs-tarball =
@echo -e '\e[1;31mPacking $@...\e[m'
cd $<; sudo tar -zcpf ../$@ `sudo ls`
sudo chown `id -un` $@
endef

define prepare-ziproot =
@echo -e '\e[1;31mPreparing $@...\e[m'
mkdir $@
cp $(word 2,$^) $@/
cp $< $@/rootfs.tar.gz
endef

define pack-zip =
@echo -e '\e[1;31mPacking $@\e[m'
cd $<; zip ../$@ *
endef
.PHONY: all clean

all: zip
all: all-x86_64 all-aarch64

.PHONY: all zip exe clean
zip: VoidGlibc.zip VoidMusl.zip
all-x86_64: icons.zip void-x86_64 void-x86_64-musl
all-aarch64: icons.zip void-aarch64 void-aarch64-musl

VoidGlibc.zip: ziproot-glibc
$(pack-zip)
void-x86_64 void-x86_64-musl void-aarch64 void-aarch64-musl:
@echo -e '\e[1;31mDownloading $(BASE_URL)/$@-ROOTFS-$(VOID_REVISION).tar.xz...\e[m'
curl -LO $(BASE_URL)/$@-ROOTFS-$(VOID_REVISION).tar.xz

VoidMusl.zip: ziproot-musl
$(pack-zip)
@echo -e '\e[1;31mPreparing [email protected]...\e[m'
@mkdir $@-zip
@cp Void.exe $@-zip/[email protected]

ziproot-glibc: rootfs-glibc.tar.gz void-glibc.exe
$(prepare-ziproot)
@echo -e '\e[1;31mPreparing [email protected]...\e[m'
@mkdir $@
tar -xpf $@-ROOTFS-$(VOID_REVISION).tar.xz -C $@
cp -f /etc/resolv.conf $@/etc/resolv.conf
chroot $@ /sbin/xbps-install --sync --update --yes
rm -rf `find $@/var/cache/xbps/ -type f`
rm $@/etc/resolv.conf
chmod +x $@

ziproot-musl: rootfs-musl.tar.gz void-musl.exe
$(prepare-ziproot)
@echo -e '\e[1;31mPacking rootfs.tar.gz...\e[m'
@cd $@; tar -zcpf ../$@-zip/rootfs.tar.gz `ls`
chown `id -un` $@-zip/rootfs.tar.gz

rootfs-glibc.tar.gz: rootfs-glibc
$(pack-rootfs-tarball)

rootfs-musl.tar.gz: rootfs-musl
$(pack-rootfs-tarball)

rootfs-glibc: base-glibc.tar.xz
$(prepare-rootfs)

rootfs-musl: base-musl.tar.xz
$(prepare-rootfs)

base-glibc.tar.xz:
@echo -e '\e[1;31mDownloading $@...\e[m'
$(DLR) $(DLR_FLAGS) $(VOID_GLIBC_URL) -o $@

base-musl.tar.xz:
@echo -e '\e[1;31mDownloading $@...\e[m'
$(DLR) $(DLR_FLAGS) $(VOID_MUSL_URL) -o $@

exe: void-glibc.exe void-musl.exe
$(LNCR_ZIP_EXE): icons.zip
@echo -e '\e[1;31mExtracting $@...\e[m'
unzip $< $@

void-glibc.exe: $(LNCR_ZIP_EXE)
@cp $(LNCR_ZIP_EXE) $@

void-musl.exe: $(LNCR_ZIP_EXE)
@cp $(LNCR_ZIP_EXE) $@
@echo -e '\e[1;31mPacking [email protected]\e[m'
@cd $@-zip; zip ../[email protected] *

icons.zip:
@echo -e '\e[1;31mDownloading $@...\e[m'
$(DLR) $(DLR_FLAGS) $(LNCR_ZIP_URL) -o $@
curl -LO $(LNCR_ZIP_URL)
@echo -e '\e[1;31mExtracting $@...\e[m'
unzip $@ Void.exe

clean:
@echo -e '\e[1;31mCleaning files...\e[m'
-rm VoidGlibc.zip VoidMusl.zip
-rm -r ziproot-glibc ziproot-musl
-rm rootfs-glibc.tar.gz rootfs-musl.tar.gz
-sudo rm -r rootfs-glibc rootfs-musl
-rm base-glibc.tar.xz base-musl.tar.xz
-rm void-glibc.exe void-musl.exe
-rm $(LNCR_ZIP_EXE)
-rm icons.zip
rm -rf void-* Void.exe icons.zip

0 comments on commit fb7591d

Please sign in to comment.