mirror of
https://github.com/richfelker/musl-cross-make.git
synced 2025-04-18 15:04:59 +02:00
Feat: github action
This commit is contained in:
parent
007f7241fe
commit
42ca9b2843
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
26
.github/workflows/build.yml
vendored
Normal file
26
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
name: Build
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
bash scripts/build.sh
|
34
.github/workflows/release.yml
vendored
Normal file
34
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
name: Release
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
bash scripts/build.sh
|
||||
|
||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "v${{ steps.get_version.outputs.VERSION }}"
|
||||
title: "Version ${{ steps.get_version.outputs.VERSION }}"
|
||||
prerelease: ${{ contains(steps.get_version.outputs.VERSION, 'rc') || contains(steps.get_version.outputs.VERSION, 'beta') || contains(steps.get_version.outputs.VERSION, 'alpha') }}
|
||||
files: |
|
||||
dist/*
|
28
.github/workflows/release_dev.yml
vendored
Normal file
28
.github/workflows/release_dev.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: release_dev
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release_dev:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
name: Release
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
bash scripts/build.sh
|
||||
|
||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
automatic_release_tag: "dev"
|
||||
title: "Dev Build"
|
||||
prerelease: true
|
||||
files: |
|
||||
dist/*
|
@ -19,8 +19,6 @@ ifeq ($(CPUS),)
|
||||
CPUS = $(shell if command -v nproc >/dev/null 2>&1; then nproc; else echo 1; fi)
|
||||
endif
|
||||
|
||||
MAKE += -j$(CPUS)
|
||||
|
||||
ifneq ($(findstring fdpic,$(TARGET)),)
|
||||
GCC_CONFIG_FOR_TARGET += --enable-fdpic
|
||||
endif
|
||||
@ -229,7 +227,7 @@ obj_binutils/.lc_configured: | obj_binutils src_binutils
|
||||
touch $@
|
||||
|
||||
obj_binutils/.lc_built: | obj_binutils/.lc_configured
|
||||
cd obj_binutils && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" all
|
||||
cd obj_binutils && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" all
|
||||
touch $@
|
||||
|
||||
obj_gcc/.lc_configured: | obj_gcc src_gcc
|
||||
@ -237,7 +235,7 @@ obj_gcc/.lc_configured: | obj_gcc src_gcc
|
||||
touch $@
|
||||
|
||||
obj_gcc/gcc/.lc_built: | obj_gcc/.lc_configured
|
||||
cd obj_gcc && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" all-gcc
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" all-gcc
|
||||
touch $@
|
||||
|
||||
obj_musl/.lc_configured: | obj_musl src_musl
|
||||
@ -245,32 +243,32 @@ obj_musl/.lc_configured: | obj_musl src_musl
|
||||
touch $@
|
||||
|
||||
obj_sysroot/.lc_headers: | obj_musl/.lc_configured obj_sysroot
|
||||
cd obj_musl && $(MAKE) DESTDIR=$(CURDIR)/obj_sysroot install-headers
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) DESTDIR=$(CURDIR)/obj_sysroot install-headers
|
||||
touch $@
|
||||
|
||||
obj_gcc/$(TARGET)/libgcc/libgcc.a: | obj_sysroot/.lc_headers
|
||||
cd obj_gcc && $(MAKE) MAKE="$(MAKE) enable_shared=no $(LIBTOOL_ARG)" all-target-libgcc
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) enable_shared=no $(LIBTOOL_ARG)" all-target-libgcc
|
||||
|
||||
obj_musl/.lc_built: | obj_musl/.lc_configured
|
||||
cd obj_musl && $(MAKE) $(MUSL_VARS)
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) $(MUSL_VARS)
|
||||
touch $@
|
||||
|
||||
obj_sysroot/.lc_libs: | obj_musl/.lc_built
|
||||
cd obj_musl && $(MAKE) $(MUSL_VARS) DESTDIR=$(CURDIR)/obj_sysroot install
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) $(MUSL_VARS) DESTDIR=$(CURDIR)/obj_sysroot install
|
||||
touch $@
|
||||
|
||||
obj_gcc/.lc_built: | obj_gcc/.lc_configured obj_gcc/gcc/.lc_built
|
||||
cd obj_gcc && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)"
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)"
|
||||
touch $@
|
||||
|
||||
install-musl: | obj_musl/.lc_built
|
||||
cd obj_musl && $(MAKE) $(MUSL_VARS) DESTDIR=$(DESTDIR)$(OUTPUT)$(SYSROOT) install
|
||||
cd obj_musl && $(MAKE) -j$(CPUS) $(MUSL_VARS) DESTDIR=$(DESTDIR)$(OUTPUT)$(SYSROOT) install
|
||||
|
||||
install-binutils: | obj_binutils/.lc_built
|
||||
cd obj_binutils && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
|
||||
cd obj_binutils && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
|
||||
|
||||
install-gcc: | obj_gcc/.lc_built
|
||||
cd obj_gcc && $(MAKE) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
|
||||
cd obj_gcc && $(MAKE) -j$(CPUS) MAKE="$(MAKE) $(LIBTOOL_ARG)" DESTDIR=$(DESTDIR)$(OUTPUT) install
|
||||
ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc
|
||||
|
||||
ifneq ($(LINUX_SRCDIR),)
|
||||
@ -286,7 +284,7 @@ src_kernel_headers: | $(LINUX_SRCDIR)
|
||||
ln -sf "$(LINUX_SRCDIR)" $@
|
||||
obj_kernel_headers/.lc_built: | src_kernel_headers
|
||||
mkdir -p $(CURDIR)/obj_kernel_headers/staged
|
||||
cd src_kernel_headers && $(MAKE) ARCH=$(LINUX_ARCH) O=$(CURDIR)/obj_kernel_headers INSTALL_HDR_PATH=$(CURDIR)/obj_kernel_headers/staged headers_install HOSTCC="$(CC) $(STAT)"
|
||||
cd src_kernel_headers && $(MAKE) -j$(CPUS) ARCH=$(LINUX_ARCH) O=$(CURDIR)/obj_kernel_headers INSTALL_HDR_PATH=$(CURDIR)/obj_kernel_headers/staged headers_install HOSTCC="$(CC) $(STAT)"
|
||||
find obj_kernel_headers/staged/include '(' -name .install -o -name ..install.cmd ')' -exec rm {} +
|
||||
touch $@
|
||||
install-kernel-headers: | obj_kernel_headers/.lc_built
|
||||
|
57
scripts/build.sh
Normal file
57
scripts/build.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
function ChToScriptFileDir() {
|
||||
cd "$(dirname "$0")"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "cd to script file dir error"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function Init() {
|
||||
cd ..
|
||||
DIST="dist"
|
||||
mkdir -p "$DIST"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "mkdir dist dir ${DIST} error"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function Build() {
|
||||
TARGET="$1"
|
||||
make TARGET=${TARGET} GCC_VER="11.4.0" \
|
||||
MUSL_VER="1.2.4" \
|
||||
BINUTILS_VER="2.40" \
|
||||
GMP_VER="6.3.0" \
|
||||
MPC_VER="1.3.1" \
|
||||
MPFR_VER="4.2.1" \
|
||||
ISL_VER="" \
|
||||
LINUX_VER="" \
|
||||
'COMMON_CONFIG+=CFLAGS="-g0 -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s"' \
|
||||
install
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "build ${TARGET} error"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf output/${TARGET}
|
||||
tar -zcvf ${DIST}/${TARGET}.tgz output/*
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "package ${TARGET} error"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf output/*
|
||||
}
|
||||
|
||||
function BuildAll() {
|
||||
while read line; do
|
||||
if [ -z "$line" ] || [ "${line:0:1}" == "#" ]; then
|
||||
continue
|
||||
fi
|
||||
Build "$line"
|
||||
done <scripts/triples.txt
|
||||
}
|
||||
|
||||
ChToScriptFileDir
|
||||
Init
|
||||
BuildAll
|
@ -1,6 +1,3 @@
|
||||
# Comment out lines you do not wish to build.
|
||||
# Do not leave any blank lines in this file.
|
||||
#
|
||||
aarch64-linux-musl
|
||||
aarch64_be-linux-musl
|
||||
arm-linux-musleabi
|
||||
@ -51,4 +48,4 @@ sh2eb-linux-muslfdpic
|
||||
sh4-linux-musl
|
||||
sh4eb-linux-musl
|
||||
x86_64-linux-musl
|
||||
x86_64-linux-muslx32
|
||||
x86_64-linux-muslx32
|
Loading…
Reference in New Issue
Block a user