Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

chore: switch default prefix from /usr to / #2

Merged
merged 27 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
294154a
feat: added support for automatically insatll dependencies and build
chiichen Apr 4, 2024
f73a070
chore: fix workflow path
chiichen Apr 4, 2024
ea282f6
chore: fix install_deps.sh
chiichen Apr 4, 2024
e588214
chore: update workflow
chiichen Apr 4, 2024
d990b89
chore: update install script
chiichen Apr 4, 2024
eb091c2
chore: update workflow
chiichen Apr 4, 2024
f3b292b
chore: update workflow
chiichen Apr 4, 2024
9984217
chore: update workflow
chiichen Apr 4, 2024
33c9e89
chore: update workflow
chiichen Apr 4, 2024
739d21c
chore: update workflow
chiichen Apr 4, 2024
66b99c5
chore: update workflow
chiichen Apr 4, 2024
e799add
chore: automatically release
chiichen Apr 4, 2024
968ae14
chore: update workflow
chiichen Apr 4, 2024
104e73b
chore: remove unused pip dep
chiichen Apr 4, 2024
4f69343
chore: remove comments
chiichen Apr 4, 2024
6966386
chore: add seperated configure script for cross compile
chiichen Apr 5, 2024
7000d44
ci: add cross compile support
chiichen Apr 5, 2024
6e9e4cc
ci: fix bash command error
chiichen Apr 5, 2024
52fcff9
ci: fix arch name
chiichen Apr 5, 2024
13f421d
chore: fix cross compile error
chiichen Apr 5, 2024
459f668
ci: fix unexported arch variable
chiichen Apr 5, 2024
0dbad06
chore: fix command error
chiichen Apr 5, 2024
668775d
chore: fix command error
chiichen Apr 5, 2024
b76d91c
ci: switch file structure & remove aarch64 target
chiichen Apr 5, 2024
f69e785
chore: update config
chiichen Apr 5, 2024
9f41bdd
chore: x86_64 release & add dragonos build script
chiichen Apr 5, 2024
5ceb56c
chore: switch default prefix from /usr to /
chiichen Apr 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .github/workflows/glibc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: glibc

on:
push:
tags:
- "v*"

jobs:
meta:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.set_tag.outputs.tag }}
prerelease: ${{ steps.set_pre.outputs.prerelease }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: temp
show-progress: false

- name: Fetch history
if: ${{ !startsWith(github.ref, 'refs/pull/') }}
run: |
git init
cp $GITHUB_WORKSPACE/temp/.git/config ./.git
rm -rf $GITHUB_WORKSPACE/temp
# git config remote.origin.fetch '+refs/*:refs/*'
git fetch --filter=tree:0 # --update-head-ok
git reset --hard origin/$(git branch --show-current) || true
git checkout ${{ github.ref_name }}

- name: Set tag
id: set_tag
run: |
${{ startsWith(github.ref, 'refs/pull/') && 'cd temp' || '' }}
echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
exit ${PIPESTATUS[0]}

- name: Judge pre-release
id: set_pre
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
if [[ '${{ steps.set_tag.outputs.tag }}' =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo prerelease=false | tee -a $GITHUB_OUTPUT
else
echo prerelease=true | tee -a $GITHUB_OUTPUT
fi

- name: Generate changelog
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
this_tag=${{ steps.set_tag.outputs.tag }}
if [[ '${{ steps.set_pre.outputs.prerelease }}' != 'false' ]]; then
last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}')
else
last_tag=$(git describe --tags --match "v*" --abbrev=0 --exclude='${{ steps.set_tag.outputs.tag }}' --exclude='*-*')
fi
echo >> CHANGELOG.md
echo "**Full Changelog**: [$last_tag -> $this_tag](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/${last_tag}...${this_tag})" >> CHANGELOG.md

- name: Upload changelog to Github
uses: actions/upload-artifact@v4
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
name: changelog
path: CHANGELOG.md

build:
needs: meta
runs-on: ubuntu-latest
strategy:
matrix:
# arch: [x86_64,riscv64,aarch64]
arch: [x86_64]
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
export ARCH=${{matrix.arch}}
bash ./install_deps.sh
- name: Configure
run: |
export ARCH=${{matrix.arch}}
bash ./default_configure.sh
- name: Build
run: |
cd build
make -j $(nproc)
make install DESTDIR=$GITHUB_WORKSPACE/install -j $(nproc)
- name: Package glibc
run: |
mkdir -p release
cd install && ls -ahl && tar czvf $GITHUB_WORKSPACE/release/glibc-${{matrix.arch}}-${{ needs.meta.outputs.tag }}.tar.gz .
- name: Upload to Github
uses: actions/upload-artifact@v4
with:
name: glibc-${{matrix.arch}}
path: |
release/*.tar.gz
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [meta, build]
runs-on: ubuntu-latest
steps:
- name: Download glibc from Github
uses: actions/download-artifact@v4
with:
path: assets

- name: Cleanup files
run: |
mv -vf assets/changelog/* .
cd assets
find . -type f | while read f; do mv -fvt . $f; done

- name: Release to Github
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: |
assets/*
prerelease: ${{ needs.meta.outputs.prerelease != 'false' }}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ core
/linuxthreads_db
/rtkaio
*.pyc
build
install
release
19 changes: 19 additions & 0 deletions default_configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
mkdir -p build
mkdir -p install
if [ -z "$ARCH" ] || [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "riscv64" ] && [ "$ARCH" != "aarch64" ]; then
echo "No ARCH specified, use x86_64 as default"
export ARCH="x86_64"
fi
if [ "$ARCH" == "x86_64" ] || [ "$ARCH" == "riscv64" ] || [ "$ARCH" == "aarch64" ]; then
export TRIPLET=${ARCH}-linux-gnu
fi
export BUILD=`uname -m`
cd build
../configure \
--prefix=/ \
--host=${TRIPLET} \
--build=${BUILD}-linux-gnu \
CC="${TRIPLET}-gcc -m64" \
CXX="${TRIPLET}-g++ -m64" \
CFLAGS="-O2" \
CXXFLAGS="-O2"
5 changes: 5 additions & 0 deletions dragonos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bash install_deps.sh
bash default_configure.sh
cd build
make -j $(nproc)
DESTDIR=$DADK_CURRENT_BUILD_DIR make install -j $(nproc)
17 changes: 17 additions & 0 deletions install_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo apt-get install -y make gdb
sudo apt-get install -y texinfo gawk bison sed
sudo apt-get install -y python3-dev python-is-python3
if [ -z "$ARCH" ] || [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "riscv" ] && [ "$ARCH" != "aarch64" ]; then
echo "No ARCH specified, use x86_64 as default"
export ARCH="x86_64"
fi

if [ "$ARCH" == "riscv" ] || [ "$ARCH" == "aarch64" ]; then
export TRIPLET=${ARCH}-linux-gnu
fi

if [ "$ARCH" == "x86_64" ] ; then
export TRIPLET=x86-64-linux-gnu
fi

sudo apt-get install -y gcc-${TRIPLET}