diff --git a/.github/workflows/aur-check.yml b/.github/workflows/aur-check.yml new file mode 100644 index 00000000..b2fd59f4 --- /dev/null +++ b/.github/workflows/aur-check.yml @@ -0,0 +1,122 @@ +name: Arch Linux Container Validation + +on: + pull_request: + paths: + - '.github/workflows/aur-check.yml' + - 'aur/**' + push: + paths: + - '.github/workflows/aur-check.yml' + - 'aur/**' + branches: + - main + workflow_dispatch: + +jobs: + archlinux-validation: + name: Arch Linux Container Build & Test + runs-on: ubuntu-latest + container: + image: archlinux/archlinux:multilib-devel + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache Pacman Dependencies + uses: actions/cache@v4 + with: + path: /var/cache/pacman/pkg + key: ${{ runner.os }}-pacman-${{ hashFiles('/etc/pacman.conf', '/etc/makepkg.config', '/etc/makepkg/rust.conf') }} + restore-keys: | + ${{ runner.os }}-pacman- + + - name: Install base dependencies + run: | + pacman -Syu --noconfirm + + pacman -S --noconfirm \ + namcap \ + shellcheck \ + debugedit \ + fakeroot \ + sudo \ + pkgconf \ + libc++ \ + cmake \ + openssl \ + clang \ + llvm \ + perl \ + ninja \ + go \ + git \ + glibc \ + gcc-libs + + - name: Setup build user + run: | + useradd -m -s /bin/bash builder + + echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + + - name: Validate PKGBUILD files + run: | + set -e + + # Color codes + RED='\033[0;31m' + GREEN='\033[0;32m' + YELLOW='\033[1;33m' + BLUE='\033[0;34m' + MAGENTA='\033[0;35m' + CYAN='\033[0;36m' + WHITE='\033[1;37m' + NC='\033[0m' # No Color + + for pathname in aur/PKGBUILD-GIT*; do + if [ -f "${pathname}" ]; then + filename=$(basename ${pathname}) + dirname=$(dirname ${pathname}) + + echo -e "${CYAN}============ Validating [${NC}${filename}${CYAN}] ============${NC}\n\n" + + echo -e "${YELLOW}============ Running Shellcheck On${NC} ${filename} ${YELLOW}============${NC}\n" + if shellcheck --shell=bash --exclude=SC2034,SC2154,SC2164 "${pathname}"; then + echo -e "${GREEN}✅ Shellcheck passed${NC}" + else + echo -e "${RED}❌ Shellcheck failed${NC}" + exit 1 + fi + + chown -R builder:builder "${pathname}" + chown -R builder:builder "${dirname}" + + echo -e "${BLUE}============ Running Namcap On${NC} ${filename} ${BLUE}============${NC}\n" + if namcap "${pathname}"; then + echo -e "${GREEN}✅ Namcap passed${NC}" + else + echo -e "${RED}❌ Namcap failed${NC}" + exit 1 + fi + + echo -e "${MAGENTA}============ Running Makepkg On${NC} ${filename} ${MAGENTA}============${NC}" + + if sudo -u builder bash -c " + set -e + cd '${dirname}' + makepkg -scf --noconfirm -p '${filename}' + "; then + echo -e "${GREEN}✅ Makepkg completed successfully${NC}" + else + echo -e "${RED}❌ Makepkg failed${NC}" + exit 1 + fi + + echo -e "${GREEN}🎉 ${filename} Validation Completed Successfully!${NC}" + echo "" + fi + done + + echo -e "${GREEN}🚀 All PKGBUILD files validated successfully!${NC}" \ No newline at end of file diff --git a/aur/PKGBUILD-GIT b/aur/PKGBUILD-GIT index 0163a8d8..d85a6031 100644 --- a/aur/PKGBUILD-GIT +++ b/aur/PKGBUILD-GIT @@ -7,7 +7,11 @@ pkgrel=1 pkgdesc='Visualize Ownership and Lifetimes in Rust' url='https://github.com/cordx56/rustowl' license=('MPL-2.0') -makedepends=('git' 'rustup' 'zig=0.13.0') +makedepends=('git' 'rustup' 'make' 'autoconf' 'gcc' 'openssl' 'automake' 'libtool' 'cmake' 'ninja' 'go' 'glibc' 'gcc-libs' 'pkgconf' 'perl' 'clang' 'llvm' 'nasm' 'jemalloc') + +_build_deps=( + 'bindgen-cli' +) arch=('any') source=("git+https://github.com/cordx56/rustowl.git") sha256sums=('SKIP') @@ -21,24 +25,57 @@ pkgver() { prepare() { cd "$srcdir/rustowl" export RUSTC_BOOTSTRAP=1 - export RUSTUP_TOOLCHAIN=1.89.0 + export RUSTUP_TOOLCHAIN=1.88.0 rustup component add rust-src rustc-dev llvm-tools + + # Install bindgen-cli for aws-lc-sys + for dep in "${_build_deps[@]}"; do + cargo install --force --locked "$dep" + done + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" } build() { cd "$srcdir/rustowl" - export CARGO_TARGET_DIR=target export RUSTC_BOOTSTRAP=1 - export RUSTUP_TOOLCHAIN=1.89.0 + export RUSTUP_TOOLCHAIN=1.88.0 export RUSTOWL_RUNTIME_DIRS=/opt/rustowl - cargo build --frozen --release --all-features --target $(rustc --print=host-tuple) + + # Use pregenerated bindings for AWS-LC to avoid build issues + export AWS_LC_SYS_PREBUILT_NASM=1 + export AWS_LC_SYS_NO_PREFIX=1 + export AWS_LC_SYS_STATIC=1 + unset AWS_LC_SYS_CMAKE_BUILDER + + # Configure bindgen for aws-lc-sys + export BINDGEN_EXTRA_CLANG_ARGS="-I/usr/include" + export LIBCLANG_PATH=/usr/lib + + # Force jemalloc to use system library with extended API + export JEMALLOC_SYS_WITH_LG_PAGE=16 + export JEMALLOC_SYS_WITH_MALLOC_CONF="background_thread:true" + export JEMALLOC_SYS_BACKGROUND_THREAD=1 + export CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS=1 + + # Configure linker flags for jemalloc + export RUSTFLAGS="-L /usr/lib -l jemalloc" + + # Ensure proper library search paths + export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig + export LIBRARY_PATH=/usr/lib:/lib + export LD_LIBRARY_PATH=/usr/lib:/lib + + # Set target directory to avoid conflicts + export CARGO_TARGET_DIR=target + + cargo build --frozen --release --all-features --target "$(rustc --print=host-tuple)" } check() { cd "$srcdir/rustowl" export RUSTC_BOOTSTRAP=1 - export RUSTUP_TOOLCHAIN=1.89.0 + export RUSTUP_TOOLCHAIN=1.88.0 cargo test --frozen --all-features } @@ -47,7 +84,7 @@ package() { find target -type d | grep -E 'rustowl-build-time-out$' | xargs -I % cp -r % ./ mkdir sysroot ACTIVE_TOOLCHAIN="$(rustup show active-toolchain | awk '{ print $1 }')" - cp -r "$(rustc --print=sysroot)" sysroot/$ACTIVE_TOOLCHAIN + cp -r "$(rustc --print=sysroot)" sysroot/"$ACTIVE_TOOLCHAIN" find sysroot -type f | grep -v -E '\.(rlib|so|dylib|dll)$' | xargs rm -rf find sysroot -depth -type d -empty -exec rm -rf {} \; install -d -m 755 "$pkgdir/opt/rustowl"