mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-24 06:00:54 +07:00
f391cd0b09
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
208 lines
8.9 KiB
YAML
208 lines
8.9 KiB
YAML
name: Build eudev Addon
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
push:
|
|
description: "push"
|
|
default: false
|
|
type: boolean
|
|
eudev:
|
|
description: "update eudev"
|
|
default: true
|
|
type: boolean
|
|
|
|
jobs:
|
|
eudev:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
#- version: 6.2
|
|
# platform: apollolake
|
|
|
|
- version: 7.1
|
|
platform: apollolake
|
|
|
|
#- version: 7.2
|
|
# platform: apollolake
|
|
|
|
if: inputs.eudev == true
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@main
|
|
|
|
- name: Init Env
|
|
run: |
|
|
git config --global user.email "info@auxxxilium.tech"
|
|
git config --global user.name "AuxXxilium"
|
|
sudo timedatectl set-timezone "Europe/Berlin"
|
|
|
|
- name: Get EnvDeploy
|
|
# if: ${{ steps.cache-env.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
ROOT_PATH=${{ github.workspace }}
|
|
|
|
git clone https://github.com/SynologyOpenSource/pkgscripts-ng.git ${ROOT_PATH}/pkgscripts-ng
|
|
cd ${ROOT_PATH}/pkgscripts-ng
|
|
# if version == 6.2, checkout 6.2.4
|
|
git checkout DSM${{ matrix.version }}`[ "${{ matrix.version }}" = "6.2" ] && echo ".4"`
|
|
sudo ./EnvDeploy -v ${{ matrix.version }}`[ "${{ matrix.version }}" = "6.2" ] && echo ".4"` -l # Get Available platforms
|
|
sudo ./EnvDeploy -q -v ${{ matrix.version }} -p ${{ matrix.platform }}
|
|
|
|
#ENV
|
|
mkdir -p ${ROOT_PATH}/source
|
|
|
|
ENV_PATH=${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}
|
|
sudo cp -al ${ROOT_PATH}/pkgscripts-ng ${ENV_PATH}/
|
|
|
|
sudo chroot ${ENV_PATH} << "EOF"
|
|
cd pkgscripts
|
|
|
|
version=${{ matrix.version }}; [ ${version:0:1} -gt 6 ] && sed -i 's/print(" ".join(kernels))/pass #&/' ProjectDepends.py
|
|
sed -i '/PLATFORM_FAMILY/a\\techo "PRODUCT=$PRODUCT" >> $file\n\techo "KSRC=$KERNEL_SEARCH_PATH" >> $file\n\techo "LINUX_SRC=$KERNEL_SEARCH_PATH" >> $file' include/build
|
|
./SynoBuild -c -p ${{ matrix.platform }}
|
|
|
|
while read line; do if [ ${line:0:1} != "#" ]; then export ${line%%=*}="${line#*=}"; fi; done < /env${BUILD_ARCH}.mak
|
|
if [ -f "${KSRC}/Makefile" ]; then
|
|
# gcc issue "unrecognized command-line option '--param=allow-store-data-races=0'".
|
|
[ "${{ matrix.version }}" == "7.2" ] && sed -i 's/--param=allow-store-data-races=0/--allow-store-data-races/g' ${KSRC}/Makefile
|
|
|
|
VERSION=`cat ${KSRC}/Makefile | grep ^VERSION | awk -F' ' '{print $3}'`
|
|
PATCHLEVEL=`cat ${KSRC}/Makefile | grep ^PATCHLEVEL | awk -F' ' '{print $3}'`
|
|
SUBLEVEL=`cat ${KSRC}/Makefile | grep ^SUBLEVEL | awk -F' ' '{print $3}'`
|
|
[ -f "/env32.mak" ] && echo "KVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" >> /env32.mak
|
|
[ -f "/env64.mak" ] && echo "KVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" >> /env64.mak
|
|
CCVER=`$CC --version | head -n 1 | awk -F' ' '{print $3}'`
|
|
[ -f "/env32.mak" ] && echo "CCVER=${CCVER}" >> /env32.mak
|
|
[ -f "/env64.mak" ] && echo "CCVER=${CCVER}" >> /env64.mak
|
|
fi
|
|
EOF
|
|
|
|
[ -f ${ENV_PATH}/env64.mak ] && ENV_FILE=${ENV_PATH}/env64.mak || ([ -f ${ENV_PATH}/env32.mak ] && ENV_FILE=${ENV_PATH}/env32.mak)
|
|
if [ -n "${ENV_FILE}" ]; then
|
|
KVER=`grep 'KVER=' ${ENV_FILE} | awk -F'=' '{print $2}'`
|
|
CCVER=`grep 'CCVER=' ${ENV_FILE} | awk -F'=' '{print $2}'`
|
|
[ -n "${KVER}" ] && echo "KVER=${KVER}" >> $GITHUB_ENV
|
|
[ -n "${CCVER}" ] && echo "CCVER=${CCVER}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Get Src
|
|
run: |
|
|
ROOT_PATH=${{ github.workspace }}
|
|
|
|
mkdir -p ${ROOT_PATH}/source/output
|
|
|
|
KVER=${{ env.KVER }}
|
|
|
|
sudo cp -a ${ROOT_PATH}/eudev/src ${ROOT_PATH}/source/input
|
|
|
|
sudo cp -a ${ROOT_PATH}/source ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/
|
|
|
|
- name: Make
|
|
run: |
|
|
ROOT_PATH=${{ github.workspace }}
|
|
|
|
sudo chroot build_env/ds.${{ matrix.platform }}-${{ matrix.version }} << "EOF"
|
|
sed -i 's/^CFLAGS=/#CFLAGS=/g; s/^CXXFLAGS=/#CXXFLAGS=/g' /env${BUILD_ARCH}.mak
|
|
while read line; do if [ ${line:0:1} != "#" ]; then export ${line%%=*}="${line#*=}"; fi; done < /env${BUILD_ARCH}.mak
|
|
|
|
# build kmod
|
|
git clone -c http.sslVerify=false --single-branch https://github.com/kmod-project/kmod.git /tmp/kmod
|
|
cd /tmp/kmod
|
|
git checkout v30
|
|
patch -p1 < /source/input/kmod.patch
|
|
./autogen.sh
|
|
./configure CC=${CC} CFLAGS='-O2' --host=${HOST} --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --enable-tools --disable-manpages --disable-python --without-zstd --without-xz --without-zlib --without-openssl
|
|
[ -z "`grep 'env.mak' Makefile`" ] && sed -i '1 i include /env.mak' Makefile
|
|
make all
|
|
make install
|
|
make DESTDIR=/source/output install
|
|
|
|
# build eudev
|
|
git clone -c http.sslVerify=false --single-branch https://github.com/systemd/systemd.git /tmp/systemd
|
|
git clone -c http.sslVerify=false --single-branch https://github.com/AuxXxilium/eudev.git /tmp/eudev
|
|
cd /tmp/eudev
|
|
git checkout master
|
|
|
|
# error: 'for' loop initial declarations are only allowed in C99 or C11 mode
|
|
if [ "${{ matrix.version }}" = "6.2" ]; then
|
|
sed -i 's/for (char \*p/char \*p = NULL; for (p/g' ./src/shared/util.h
|
|
sed -i 's/for (size_t a/size_t a = 0; for(a/g; s/for (size_t i/size_t i = 0; for(i/g; s/for (uint16_t i/uint16_t i = 0; for(i/g' ./src/dmi_memory_id/dmi_memory_id.c
|
|
sed -i 's/for (size_t pos/size_t pos = 0; for (pos/g; s/for (size_t i/size_t i = 0; for(i/g' ./src/fido_id/fido_id_desc.c
|
|
fi
|
|
|
|
cp -vf /tmp/systemd/hwdb.d/*.ids /tmp/systemd/hwdb.d/*.hwdb hwdb/
|
|
./autogen.sh
|
|
./configure CC=${CC} --host=${HOST} --prefix=/usr --sysconfdir=/etc --disable-manpages --disable-selinux --disable-mtd_probe --enable-kmod
|
|
[ -z "`grep 'env.mak' Makefile`" ] && sed -i '1 i include /env.mak' Makefile
|
|
make -i CFLAGS="-DSG_FLAG_LUN_INHIBIT=2" all
|
|
make -i CFLAGS="-DSG_FLAG_LUN_INHIBIT=2" DESTDIR=/source/output install
|
|
# ldd /source/output/usr/bin/kmod | awk '{if (match($3,"/")){ printf("%s "),$3 } }'
|
|
# ldd /source/output/usr/bin/udevadm | awk '{if (match($3,"/")){ printf("%s "),$3 } }'
|
|
rm -Rf /source/output/usr/share /source/output/usr/include /source/output/usr/lib/pkgconfig /source/output/usr/lib/libudev.*
|
|
cp -f ${ToolChainSysRoot}/usr/lib/libblkid.so.1 /source/output/usr/lib/libblkid.so.1
|
|
ln -sf /usr/bin/kmod /source/output/usr/sbin/depmod
|
|
cp -f /source/input/99-usb-realtek-net.rules /source/output/usr/lib/udev/rules.d/99-usb-realtek-net.rules
|
|
rm -f /source/output/usr/lib/udev/rules.d/60-persistent-storage.rules
|
|
rm -f /source/output/usr/lib/udev/rules.d/60-persistent-storage-tape.rules
|
|
rm -f /source/output/usr/lib/udev/rules.d/80-net-name-slot.rules
|
|
chown 1000.1000 -R /source/output
|
|
EOF
|
|
|
|
sudo cp -a ${ROOT_PATH}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/output ${ROOT_PATH}/source/
|
|
sudo chmod a+rw -R ${ROOT_PATH}/source/output
|
|
|
|
- name: Tar to Artifacts
|
|
run: |
|
|
tar caf ${{ github.workspace }}/source/eudev-${{ matrix.version }}.tgz -C ${{ github.workspace }}/source/output .
|
|
|
|
- name: Upload to Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: addons
|
|
path: |
|
|
${{ github.workspace }}/source/*.tgz
|
|
|
|
- name: clean
|
|
run: |
|
|
sudo rm -rf ${{ github.workspace }}/build_env/ds.${{ matrix.platform }}-${{ matrix.version }}/source/*
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: eudev
|
|
if: inputs.push == true
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@main
|
|
|
|
- name: Init Env
|
|
run: |
|
|
git config --global user.email "info@auxxxilium.tech"
|
|
git config --global user.name "AuxXxilium"
|
|
sudo timedatectl set-timezone "Europe/Berlin"
|
|
|
|
- name: download to artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: addons
|
|
path: ./artifacts
|
|
|
|
- name: Check and Push
|
|
run: |
|
|
if [ `ls artifacts/*.tgz 2> /dev/null | wc -l` -gt 0 ]; then
|
|
echo "Copy eudev ..."
|
|
rm -rf eudev/all/addons/*
|
|
mv -f artifacts/*.tgz eudev/all/addons/
|
|
|
|
echo "Git push ..."
|
|
git pull
|
|
status=$(git status -s | grep -E 'eudev/all/addons/' | awk '{printf " %s", $2}')
|
|
if [ -n "${status}" ]; then
|
|
git add ${status}
|
|
git commit -m "eudev: update $(date +%Y-%m-%d" "%H:%M:%S)"
|
|
git push -f
|
|
fi
|
|
else
|
|
echo "No change ..."
|
|
fi |