Files
bun.sh/scripts/setup.sh
dave caruso 441612917d windows: more windows stuff (#6938)
* fix(win/upgrade): do not show powershell expand-archive info while upgrading

* start working bun run

* experiment: `bun.new`

* you can now bun run

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* stuff

* fix stuff

* fix this

* farther but not really

* sadfs

* path hell

not sure how much worse or better this makes things. its a mess. windows path handlign is a mess aaaaaaaaaaaaaaaa

* path.resolve bs

* remove old build system stuff from pr

* a

* fix some path.parse/join cases

* path closer not perfect

* normalize and join tests tests  done

* paths

* implement path.relative

* ,

* stuff

* assert

* fix compile

* hate

* the code isnt great

* stuff

* housekeeping for build system

* blah

* explain windows sitaution in docs

* some progress? not much though

* zig compiler crashes here

* fix

* yippee

* ok

* a

* ala wala

* fix builds on stuff

* clean

* the tests now run

* a

* aa

* dedupe uv event loop

* fix fs test accuracy

* stuff

* [autofix.ci] apply automated fixes

* huge updat e

* [autofix.ci] apply automated fixes

* url

* [autofix.ci] apply automated fixes

* start windows spawnSync

* [autofix.ci] apply automated fixes

* add --webkit for update submodules

* add better err message for `bun setup`

* fix unix platform build

* .

* [autofix.ci] apply automated fixes

* un-upgrade libarchive

* z

* asdfghj

* wrk

* todo -> panic

* ok

* a

* [autofix.ci] apply automated fixes

* fix build scripts l ol

* dfghj

* fa

* [autofix.ci] apply automated fixes

* aaaa

* a

* l

* [autofix.ci] apply automated fixes

* more logs

* [autofix.ci] apply automated fixes

* j

* fix init_command

* CORE DUMP HELL

* i swear im being pranked by the github actions gods

* fadsjkfdshjkhjkdfsahjkdfshjksdafjkhhjkfdsahfsdkjhfsdjkahf

* thanks IAS

* this is the correct fix

* personal review

* ddisablbe these

* revisions!

* ok

* fix submodule

* stuff

* fix libarchive

* [autofix.ci] apply automated fixes

* stuff

* [autofix.ci] apply automated fixes

* a

* fix addressToJS on windows

* make dns async again

* dx: add flag to update submodules ps1 to clone webkit

* dns error case for libuv

* dx improvements on windows

* newline

* obvious fix

* install steps

* extra note

* fix fs test

* Update building-windows.md

* fix builtins bundler to support \r\n line endnigs

* better

* some windows stuff

* a

* a

* a

* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

* [autofix.ci] apply automated fixes

* bunfile text works

* fix build on the mac

* hellooooooooooo

* install steps

* ci for baseline?

* fix

* aaa

* wow

* install script revamp

* bug

* OK

* ok

* aaaaaaaaaaaaaa

* okay

* fix the node test runner lol

* fix napi stuff

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2023-12-14 16:56:33 -08:00

114 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
C_BOLD="\e[1;1m"
C_GREEN="\e[32m"
C_RED="\e[31m"
C_BLUE="\e[34m"
C_RESET="\e[0m"
has_exec() {
which "$1" >/dev/null 2>&1 || return 1
}
fail() {
has_failure=1
printf "${C_RED}setup error${C_RESET}: %s\n" "$@"
}
LLVM_VERSION=16
# this compiler detection could be better
# it is copy pasted from ./env.sh
CC=${CC:-$(which clang-16 || which clang || which cc)}
CXX=${CXX:-$(which clang++-16 || which clang++ || which c++)}
test -n "$CC" || fail "missing LLVM $LLVM_VERSION (could not find clang)"
test -n "$CXX" || fail "missing LLVM $LLVM_VERSION (could not find clang++)"
for type in CC CXX; do
compiler="${!type}"
$(
"$compiler" --version | grep "clang version ${LLVM_VERSION}." >/dev/null 2>&1
) || fail "LLVM ${LLVM_VERSION} is required. Detected $type as '$compiler'"
done
has_exec "zig" || fail "'zig' is missing"
has_exec "bun" || fail "you need an existing copy of 'bun' in your path to build bun"
has_exec "cmake" || fail "'cmake' is missing"
has_exec "ninja" || fail "'ninja' is missing"
$(
has_exec "rustc" \
&& (test $(cargo --version | awk '{print $2}' | cut -d. -f2) -gt 57) \
&& has_exec "cargo"
) || fail "Rust and Cargo version must be installed (minimum version 1.57)"
has_exec "go" || fail "'go' is missing"
has_exec "pkg-config" || fail "'pkg-config' is missing"
has_exec "automake" || fail "'automake' is missing"
has_exec "perl" || fail "'perl' is missing"
has_exec "ruby" || fail "'ruby' is missing"
if [ -n "$has_failure" ]; then
exit 1
fi
rm -f .vscode/clang++
ln -s "$CXX" .vscode/clang++
printf "All system dependencies OK\n"
printf "C Compiler for dependencies: ${CC}\n"
printf "C++ Compiler for dependencies: ${CXX}\n"
cd "$(dirname "${BASH_SOURCE[0]}")"
bash ./update-submodules.sh
bash ./all-dependencies.sh
cd ../
# Install bun dependencies
bun i
# Install test dependencies
cd test; bun i; cd ..
# TODO(@paperdave): do not use the Makefile please
has_exec "make" || fail "'make' is missing"
make runtime_js fallback_decoder bun_error node-fallbacks
mkdir -p build
rm -f build/CMakeCache.txt
cmake -B build -S . \
-G Ninja \
-DUSE_DEBUG_JSC=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
-UZIG_COMPILER "$*" \
ninja -C build
printf "Checking if built bun functions\n"
BUN_VERSION=$(BUN_DEBUG_QUIET_LOGS=1 ./build/bun-debug --version)
printf "\n"
printf "🎉 ${C_GREEN}${C_BOLD}Development environment setup complete!${C_RESET}\n"
printf "${C_BLUE}bun v${BUN_VERSION} is located at ./build/bun-debug${C_RESET}\n"
if has_exec bun-debug; then
bun_is_at=$(which bun-debug)
if [ "$(realpath "$bun_is_at")" != "$(realpath "./build/bun-debug")" ]; then
printf "\n"
printf "${C_RED}"'Your $PATH is not configured correctly!\n'"${C_RESET}"
printf "\n"
printf "which bun-debug --> %s\n" "${bun_is_at}"
printf "\n"
printf "You should remove this binary and switch it to ./build:\n"
printf ' export PATH="$PATH:%s"\n' $(realpath "$PWD/build")
fi
else
printf "\n"
printf "You should add ./build to your path:\n"
printf ' export PATH="$PATH:%s"\n' $(realpath "$PWD/build")
fi
printf "\n"
printf "To rebuild bun, run '${C_GREEN}bun run build${C_RESET}'\n\n"