diff --git a/install.sh b/install.sh index c8221591..a687efac 100755 --- a/install.sh +++ b/install.sh @@ -6,21 +6,22 @@ INSTALL_DIR="$HOME/.chadscript" VERSION="0.1.0" if [ -t 1 ]; then - BOLD='\033[1m' - DIM='\033[2m' - GREEN='\033[32m' - CYAN='\033[36m' - YELLOW='\033[33m' - RED='\033[31m' - RESET='\033[0m' + ESC=$(printf '\033') + BOLD="${ESC}[1m" + DIM="${ESC}[2m" + GREEN="${ESC}[32m" + CYAN="${ESC}[36m" + YELLOW="${ESC}[33m" + RED="${ESC}[31m" + RESET="${ESC}[0m" else BOLD='' DIM='' GREEN='' CYAN='' YELLOW='' RED='' RESET='' fi -info() { printf "${CYAN}info${RESET} %s\n" "$1"; } -success() { printf "${GREEN} ✓${RESET} %s\n" "$1"; } -warn() { printf "${YELLOW}warn${RESET} %s\n" "$1"; } -err() { printf "${RED}error${RESET} %s\n" "$1" >&2; exit 1; } +info() { printf "%s\n" "${CYAN}info${RESET} $1"; } +success() { printf "%s\n" "${GREEN} ✓${RESET} $1"; } +warn() { printf "%s\n" "${YELLOW}warn${RESET} $1"; } +err() { printf "%s\n" "${RED}error${RESET} $1" >&2; exit 1; } detect_libc() { if [ "$(uname -s)" != "Linux" ]; then @@ -135,7 +136,9 @@ WRAPPER printf "\n" printf " Then try:\n" printf "\n" - printf " ${CYAN}chad run examples/hello.ts${RESET}\n" + printf " ${CYAN}mkdir myproject && cd myproject${RESET}\n" + printf " ${CYAN}chad init${RESET}\n" + printf " ${CYAN}chad run hello.ts${RESET}\n" printf "\n" } diff --git a/src/compiler.ts b/src/compiler.ts index 51e37b89..967417b9 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -244,7 +244,7 @@ export function compile(inputFile: string, outputFile: string, logLevel: LogLeve if (generator.usesSqlite) { linkLibs = `-L${brewPrefix}/sqlite/lib ` + linkLibs; } if (generator.usesMongoose) { linkLibs = `-L${brewPrefix}/zstd/lib ` + linkLibs; } const sdkPath = execSync('xcrun --show-sdk-path', { stdio: 'pipe', encoding: 'utf8' }).trim(); - linkLibs = `-isysroot ${sdkPath} -L/usr/local/lib ` + linkLibs; + linkLibs = `-Wl,-syslibroot,${sdkPath} -L/usr/local/lib ` + linkLibs; } const lwsBridgeObj = generator.usesMongoose ? `${LWS_BRIDGE_PATH}/lws-bridge.o` : ''; const regexBridgeObj = generator.usesRegex ? `${LWS_BRIDGE_PATH}/regex-bridge.o` : ''; diff --git a/src/native-compiler-lib.ts b/src/native-compiler-lib.ts index 9e93c58f..f1717b04 100644 --- a/src/native-compiler-lib.ts +++ b/src/native-compiler-lib.ts @@ -188,7 +188,7 @@ export function compileNative(inputFile: string, outputFile: string): void { if (generator.getUsesCrypto()) { linkLibs = '-L/opt/homebrew/opt/openssl/lib -L/usr/local/opt/openssl/lib ' + linkLibs; } if (generator.getUsesSqlite()) { linkLibs = '-L/opt/homebrew/opt/sqlite/lib -L/usr/local/opt/sqlite/lib ' + linkLibs; } if (generator.getUsesMongoose()) { linkLibs = '-L/opt/homebrew/opt/zstd/lib -L/usr/local/opt/zstd/lib ' + linkLibs; } - linkLibs = '-isysroot $(xcrun --show-sdk-path) -L/usr/local/lib ' + linkLibs; + linkLibs = '-Wl,-syslibroot,$(xcrun --show-sdk-path) -L/usr/local/lib ' + linkLibs; } const linkCmd = clangTool + ' ' + objFile + ' ' + lwsBridgeObj + ' ' + regexBridgeObj + ' ' + treeSitterObjs + ' -o ' + outputFile + noPie + ' ' + linkLibs; if (verbose) { console.log('Running: ' + linkCmd); }