Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
leleliu008 committed Jan 8, 2025
1 parent 3008ec1 commit 255260b
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 142 deletions.
178 changes: 36 additions & 142 deletions .github/workflows/publish-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: install -d out/
- run: ./ppkg setup
- run: ./ppkg update
- run: ./ppkg install macos-${{ matrix.target-version }}-${{ matrix.target-arch }}/[email protected]
- run: ./ppkg bundle macos-${{ matrix.target-version }}-${{ matrix.target-arch }}/[email protected] .tar.xz

- run: mv fonts.conf out/
- run: rm check-if-has-dynamic-section.c list-section-names.c print-*-if-present.c wrapper-template.c

- run: |
set -ex
Expand All @@ -45,38 +48,19 @@ jobs:
SYSROOT="$(xcrun --sdk macosx --show-sdk-path)"
CFLAGS="-isysroot $SYSROOT -mmacosx-version-min=${{ matrix.target-version }} -arch ${{ matrix.target-arch }} -Qunused-arguments"
rm check-if-has-dynamic-section.c list-section-names.c print-*-if-present.c wrapper-template.c
for f in *.c
do
o="out/${f%.c}"
o="${f%.c}.exe"
$CC $CFLAGS -std=c99 -Os -flto -o "$o" "$f"
strip "$o"
done
- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf

- run: ./ppkg setup
- run: ./ppkg update
- run: ./ppkg install macos-${{ matrix.target-version }}-${{ matrix.target-arch }}/[email protected]
- run: ./ppkg bundle macos-${{ matrix.target-version }}-${{ matrix.target-arch }}/[email protected] .tar.xz

- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.ppkg
- run: mv *.otf out/

- run: |
DIRNAME="ppkg-core-${{ needs.base.outputs.release-version }}-macos-${{ matrix.target-version }}-${{ matrix.target-arch }}"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- run: ./pack-ppkg-core ${{ needs.base.outputs.release-version }} macos-${{ matrix.target-version }}-${{ matrix.target-arch }}

- uses: actions/upload-artifact@v4
with:
name: ppkg-core-macos-${{ matrix.target-version }}-${{ matrix.target-arch }}.tar.xz
path: ppkg-core-*.tar.xz
name: ppkg-core-${{ needs.base.outputs.release-version }}-macos-${{ matrix.target-version }}-${{ matrix.target-arch }}.tar.xz
path: ppkg-core-${{ needs.base.outputs.release-version }}-macos-${{ matrix.target-version }}-${{ matrix.target-arch }}.tar.xz


linux:
Expand Down Expand Up @@ -128,38 +112,12 @@ jobs:
run ./ppkg bundle [email protected] .tar.xz
EOF
- run: curl -LO https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/master/alpine-chroot-install
- run: chmod +x alpine-chroot-install
- run: sudo ./alpine-chroot-install -d /alpine-rootfs -a ${{ matrix.target-arch }}
- run: /alpine-rootfs/enter-chroot /bin/sh run.sh

- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf

- run: install -d out/
- run: mv *.otf out/
- run: mv fonts.conf out/

- run: ls

- run: |
for item in *.exe
do
mv "$item" "out/${item%.exe}"
done
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin/ out/share/ out/.ppkg/

- run: |
DIRNAME="ppkg-core-${{ needs.base.outputs.release-version }}-linux-${{ matrix.target-arch }}"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- run: ./pack-ppkg-core ${{ needs.base.outputs.release-version }} linux-${{ matrix.target-arch }}

- uses: actions/upload-artifact@v4
with:
name: ppkg-core---linux-${{ matrix.target-arch }}.tar.xz
path: ppkg-core-*-linux-${{ matrix.target-arch }}.tar.xz
name: ppkg-core-${{ needs.base.outputs.release-version }}-linux-${{ matrix.target-arch }}.tar.xz
path: ppkg-core-${{ needs.base.outputs.release-version }}-linux-${{ matrix.target-arch }}.tar.xz


dragonflybsd:
Expand All @@ -170,21 +128,14 @@ jobs:
strategy:
fail-fast: false
matrix:
dragonflybsd-version: ['6.4']
target-version: ['6.4']

steps:
- uses: actions/checkout@v4

- run: install -d out/

- run: mv fonts.conf out/

- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: mv *.otf out/

- uses: vmactions/dragonflybsd-vm@v1
with:
release: "${{ matrix.dragonflybsd-version }}.0"
release: "${{ matrix.target-version }}.0"
usesh: true
sync: rsync
copyback: true
Expand All @@ -201,24 +152,15 @@ jobs:
for item in *.c
do
cc -std=c99 -Os -flto -Wl,-s -static -o "out/${item%.c}" "$item"
cc -std=c99 -Os -flto -Wl,-s -static -o "${item%.c}.exe" "$item"
done
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.ppkg

- run: |
DIRNAME="ppkg-core-${{ needs.base.outputs.release-version }}-dragonflybsd-${{ matrix.dragonflybsd-version }}-x86_64"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- run: ./pack-ppkg-core ${{ needs.base.outputs.release-version }} dragonflybsd-${{ matrix.target-version }}-x86_64

- uses: actions/upload-artifact@v4
with:
name: ppkg-core---dragonflybsd-${{ matrix.dragonflybsd-version }}-x86_64.tar.xz
path: ppkg-core-*-dragonflybsd-${{ matrix.dragonflybsd-version }}-x86_64.tar.xz
name: ppkg-core-${{ needs.base.outputs.release-version }}-dragonflybsd-${{ matrix.target-version }}-x86_64.tar.xz
path: ppkg-core-${{ needs.base.outputs.release-version }}-dragonflybsd-${{ matrix.target-version }}-x86_64.tar.xz


freebsd:
Expand All @@ -229,23 +171,16 @@ jobs:
strategy:
fail-fast: false
matrix:
freebsd-version: ['14.2', '14.1', '14.0', '13.4', '13.3', '13.2']
target-version: ['14.2', '14.1', '14.0', '13.4', '13.3', '13.2']
# https://archive.freebsd.org/old-releases/amd64/

steps:
- uses: actions/checkout@v4

- run: install -d out/

- run: mv fonts.conf out/

- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: mv *.otf out/

- uses: cross-platform-actions/action@master
with:
operating_system: freebsd
version: ${{ matrix.freebsd-version }}
version: ${{ matrix.target-version }}
shell: bash
run: |
run() {
Expand All @@ -260,24 +195,15 @@ jobs:
for item in *.c
do
cc -std=c99 -Os -flto -Wl,-s -static -o "out/${item%.c}" "$item"
cc -std=c99 -Os -flto -Wl,-s -static -o "${item%.c}.exe" "$item"
done
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.ppkg

- run: |
DIRNAME="ppkg-core-${{ needs.base.outputs.release-version }}-freebsd-${{ matrix.freebsd-version }}-amd64"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- run: ./pack-ppkg-core ${{ needs.base.outputs.release-version }} freebsd-${{ matrix.target-version }}-amd64

- uses: actions/upload-artifact@v4
with:
name: ppkg-core---freebsd-${{ matrix.freebsd-version }}-amd64.tar.xz
path: ppkg-core-*-freebsd-${{ matrix.freebsd-version }}-amd64.tar.xz
name: ppkg-core-${{ needs.base.outputs.release-version }}-freebsd-${{ matrix.target-version }}-amd64.tar.xz
path: ppkg-core-${{ needs.base.outputs.release-version }}-freebsd-${{ matrix.target-version }}-amd64.tar.xz


openbsd:
Expand All @@ -294,13 +220,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: install -d out/

- run: mv fonts.conf out/

- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: mv *.otf out/

- uses: cross-platform-actions/action@master
with:
operating_system: openbsd
Expand All @@ -312,31 +231,22 @@ jobs:
eval "$@"
}
run ./ppkg setup --syspm
run ./ppkg setup --syspm
run ./ppkg update
run ./ppkg install [email protected]
run ./ppkg bundle [email protected] .tar.xz
for item in *.c
do
cc -std=c99 -Os -flto -Wl,-s -static -o "out/${item%.c}" "$item"
cc -std=c99 -Os -flto -Wl,-s -static -o "${item%.c}.exe" "$item"
done
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.ppkg

- run: |
DIRNAME="ppkg-core-${{ needs.base.outputs.release-version }}-openbsd-${{ matrix.openbsd-version }}-amd64"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- run: ./pack-ppkg-core ${{ needs.base.outputs.release-version }} openbsd-${{ matrix.target-version }}-amd64

- uses: actions/upload-artifact@v4
with:
name: ppkg-core---openbsd-${{ matrix.openbsd-version }}-amd64.tar.xz
path: ppkg-core-*-openbsd-${{ matrix.openbsd-version }}-amd64.tar.xz
name: ppkg-core-${{ needs.base.outputs.release-version }}-openbsd-${{ matrix.openbsd-version }}-amd64.tar.xz
path: ppkg-core-${{ needs.base.outputs.release-version }}-openbsd-${{ matrix.openbsd-version }}-amd64.tar.xz


netbsd:
Expand All @@ -347,25 +257,18 @@ jobs:
strategy:
fail-fast: false
matrix:
netbsd-version: ['10.0', '9.4', '9.3', '9.2']
target-version: ['10.0', '9.4', '9.3', '9.2']
# https://ftp.netbsd.org/pub/NetBSD/

steps:
- uses: actions/checkout@v4

- run: curl -LO https://curl.se/ca/cacert.pem

- run: install -d out/

- run: mv fonts.conf out/

- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: mv *.otf out/

- uses: cross-platform-actions/[email protected]
- uses: cross-platform-actions/[email protected]
with:
operating_system: netbsd
version: ${{ matrix.netbsd-version }}
version: ${{ matrix.target-version }}
shell: bash
run: |
run() {
Expand All @@ -382,24 +285,15 @@ jobs:
for item in *.c
do
cc -std=c99 -Os -flto -Wl,-s -static -o "out/${item%.c}" "$item"
cc -std=c99 -Os -flto -Wl,-s -static -o "${item%.c}.exe" "$item"
done
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.ppkg

- run: |
DIRNAME="ppkg-core-${{ needs.base.outputs.release-version }}-netbsd-${{ matrix.netbsd-version }}-amd64"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- run: ./pack-ppkg-core ${{ needs.base.outputs.release-version }} netbsd-${{ matrix.target-version }}-amd64

- uses: actions/upload-artifact@v4
with:
name: ppkg-core---netbsd-${{ matrix.netbsd-version }}-amd64.tar.xz
path: ppkg-core-*-netbsd-${{ matrix.netbsd-version }}-amd64.tar.xz
name: ppkg-core-${{ needs.base.outputs.release-version }}-netbsd-${{ matrix.target-version }}-amd64.tar.xz
path: ppkg-core-${{ needs.base.outputs.release-version }}-netbsd-${{ matrix.target-version }}-amd64.tar.xz


publish:
Expand Down
31 changes: 31 additions & 0 deletions pack-ppkg-core
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

set -ex

if [ "$GITHUB_ACTIONS" != true ]
echo "this script only run via GitHub Actions."
exit 1
fi

curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
curl -LO https://git.savannah.gnu.org/cgit/config.git/tree/config.sub
curl -LO https://git.savannah.gnu.org/cgit/config.git/tree/config.guess

chmod +x config.sub config.guess

install -d out/

for item in *.exe
do
mv "$item" "out/${item%.exe}"
done

tar vxf uppm*.tar.xz -C out --strip-components=1

mv out/bin/uppm *.otf fonts.conf config.sub config.guess out/

rm -rf out/bin/ out/share/ out/.ppkg/

DIRNAME="ppkg-core-$1-$2"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"

0 comments on commit 255260b

Please sign in to comment.