Created
January 4, 2026 21:29
-
-
Save bmwalters/090d55610d3b517bba5411335b0165fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Contributor: Daniele Basso <d dot bass 05 at proton dot me> | |
| # Contributor: Carl Smedstad <[email protected]> | |
| # Maintainer: Bradley Walters <oss at walters dot app> | |
| pkgname=bun | |
| pkgver=1.3.5 | |
| _webkitver=6d0f3aac0b817cc01a846b3754b21271adedac12 | |
| _zigver=c1423ff3fc7064635773a4a4616c5bf986eb00fe | |
| pkgrel=2 | |
| pkgdesc="Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one" | |
| arch=(x86_64) | |
| url="https://github.com/oven-sh/bun" | |
| license=('MIT') | |
| depends=( | |
| gcc-libs | |
| glibc | |
| icu | |
| ) | |
| makedepends=( | |
| cargo # bun | |
| clang19 | |
| lld19 | |
| llvm19 | |
| nodejs | |
| npm | |
| esbuild | |
| zig | |
| # clang20 | |
| cmake | |
| git | |
| # lld20 | |
| # llvm20 | |
| ninja | |
| python # webkit | |
| ruby # webkit | |
| ruby-getoptlong # webkit | |
| ) | |
| options=('!lto') | |
| source=( | |
| "git+https://github.com/bmwalters/bun.git#branch=dev/codegen-runtime-agnostic" | |
| # Necessary for code generation | |
| #"$pkgname-linux-x64-$pkgver.zip::https://github.com/oven-sh/bun/releases/download/bun-v$pkgver/bun-linux-x64.zip" | |
| #"$pkgname-WebKit::git+https://github.com/oven-sh/WebKit.git#commit=$_webkitver" | |
| #"$pkgname-zig::git+https://github.com/oven-sh/zig.git#commit=$_zigver" | |
| #"$pkgname-fix-webkit-include-paths.patch" | |
| #"$pkgname-add-cmake-option-zig-local.patch" | |
| ) | |
| b2sums=('SKIP') | |
| #'f5cb85236c41fa5f049098d0a87bbbee23a55cc8321471fc878ef766570231bd04b67c6d4d24d06123271fb356564e02c5ca62c79e349e4375788c06a07e8a33' | |
| #'e936ac26e6467a85f83e8874f38b4e8868daadfe4d34363bc58f576f9691c19f6cd28aa48c6014daaccf3cccf73376aa632e8f4920b24a3cad54a8d52c32b988' | |
| #'8c867cf8d1a4895c366e9230cedd2328f7d6ee73be89cb58e794a8f226bb57c2ca7323650c4f275f8b502df4c1e2eec90c295b61079b6865d09d9ec8d8170483' | |
| #'b72ed9afcd42f84ed610b21f4a379900cc1affe694b8853992144bc3216cf9630253a7667c451f4a2e3353266e2620cffa3dbc1148cfea677de554dad5e809a7' | |
| #'fb11b321280b79ef2807c8a3947dc8ec3e413bf53471fce7891923f8bb5bcb555c672638143d838d7af6229a147dcd2f8b9a76107a35f09146b7e2da88a2cd45') | |
| prepare() { | |
| cd $pkgname | |
| #grep -q "WEBKIT_VERSION $_webkitver" cmake/tools/SetupWebKit.cmake \ | |
| # || (echo "WebKit version mismatch"; exit 1) | |
| #grep -q "ZIG_COMMIT \"$_zigver\"" cmake/tools/SetupZig.cmake \ | |
| # || (echo "Zig version mismatch"; exit 1) | |
| #patch -Np1 < ../$pkgname-fix-webkit-include-paths.patch | |
| #patch -Np1 < ../$pkgname-add-cmake-option-zig-local.patch | |
| } | |
| build() { | |
| local cmake_args_common=( | |
| -DCMAKE_INSTALL_PREFIX=/usr | |
| -Wno-dev | |
| -GNinja | |
| ) | |
| # export PATH="/usr/lib/llvm20/bin:$PATH" | |
| # CC=clang CXX=clang++ \ | |
| # cmake -S bun-WebKit -B build-WebKit \ | |
| # "${cmake_args_common[@]}" \ | |
| # -DCMAKE_BUILD_TYPE=Release \ | |
| # -DPORT=JSCOnly \ | |
| # -DENABLE_STATIC_JSC=ON \ | |
| # -DUSE_BUN_JSC_ADDITIONS=ON \ | |
| # -DUSE_BUN_EVENT_LOOP=ON \ | |
| # -DENABLE_FTL_JIT=ON \ | |
| # -DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \ | |
| # -DENABLE_REMOTE_INSPECTOR=ON | |
| # cmake --build build-WebKit --target jsc | |
| # cmake -S bun-zig -B build-zig \ | |
| # "${cmake_args_common[@]}" \ | |
| # -DCMAKE_BUILD_TYPE=None \ | |
| # -DZIG_PIE=ON \ | |
| # -DZIG_SHARED_LLVM=ON \ | |
| # -DZIG_USE_LLVM_CONFIG=ON \ | |
| # -DZIG_TARGET_TRIPLE=native-linux.6.6-gnu.2.40 \ | |
| # -DZIG_TARGET_MCPU=baseline | |
| # cmake --build build-zig | |
| # rm build-WebKit/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h | |
| # mkdir -vp bun/vendor/zig | |
| # ln -vsf "$PWD/build-zig/stage3/bin/zig" bun/vendor/zig/zig | |
| # ln -vsf "$PWD/build-zig/stage3/lib/zig" bun/vendor/zig/lib | |
| # Link system ICU libs - bun expects .a but works with .so | |
| # ln -vs /usr/lib/libicudata.so build-WebKit/lib/libicudata.a | |
| # ln -vs /usr/lib/libicui18n.so build-WebKit/lib/libicui18n.a | |
| # ln -vs /usr/lib/libicuuc.so build-WebKit/lib/libicuuc.a | |
| # export PATH="$PWD/bun-linux-x64:$PATH" | |
| # bun run --cwd=$pkgname scripts/glob-sources.mjs | |
| # local llvmver=$(clang --version | head -1 | awk '{print $3}') | |
| # cmake -S bun -B build-bun \ | |
| # "${cmake_args_common[@]}" \ | |
| # -DCMAKE_BUILD_TYPE=Release \ | |
| # -DLLVM_VERSION="$llvmver" \ | |
| # -DENABLE_LTO=ON \ | |
| # -DENABLE_ASAN=OFF \ | |
| # -DUSE_STATIC_SQLITE=OFF \ | |
| # -DUSE_STATIC_LIBATOMIC=OFF \ | |
| # -DWEBKIT_LOCAL=ON \ | |
| # -DWEBKIT_PATH="$PWD/build-WebKit" \ | |
| # -DZIG_LOCAL=ON | |
| # cmake --build build-bun | |
| # NOTE: This is also compatible with local WebKit and local Zig. | |
| # I chose not to use them here for simplicity. | |
| cd bun | |
| node ./scripts/build.mjs \ | |
| -GNinja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -B build/release \ | |
| --log-level=NOTICE \ | |
| -DBUN_EXECUTABLE="$(which node)" \ | |
| -DNPM_EXECUTABLE="$(which npm)" \ | |
| -DZIG_EXECUTABLE="$(which zig)" \ | |
| -DENABLE_ASAN=OFF \ | |
| -DCACHE_STRATEGY=none | |
| } | |
| check() { | |
| # Smoke test | |
| # ./build-bun/bun --version | |
| # echo 'console.log("ok")' | ./build-bun/bun run - | |
| ./bun/build/release/bun --version | |
| echo 'console.log("ok")' | ./bun/build/release/bun run - | |
| } | |
| package() { | |
| install -vDm755 bun/build/release/bun "$pkgdir/usr/bin/bun" | |
| ln -vs /usr/bin/bun "$pkgdir/usr/bin/bunx" | |
| install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" bun/LICENSE.md | |
| install -vDm644 bun/completions/bun.bash "$pkgdir/usr/share/bash-completion/completions/bun" | |
| install -vDm644 bun/completions/bun.fish "$pkgdir/usr/share/fish/vendor_completions.d/bun.fish" | |
| install -vDm644 bun/completions/bun.zsh "$pkgdir/usr/share/zsh/site-functions/_bun" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment