Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 15 additions & 12 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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` : '';
Expand Down
2 changes: 1 addition & 1 deletion src/native-compiler-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
Loading