mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
windows: support bun:ffi (#8114)
* compile tcc * initial linking * ffi and stuff * swag * wala * Update settings.json --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
@@ -65,9 +65,9 @@ Build-Dependency `
|
||||
Build-Dependency `
|
||||
-Script "mimalloc" `
|
||||
-Outputs @("mimalloc.lib")
|
||||
# Build-Dependency `
|
||||
# -Script "tinycc" `
|
||||
# -Outputs @("tcc.lib")
|
||||
Build-Dependency `
|
||||
-Script "tinycc" `
|
||||
-Outputs @("tcc.lib")
|
||||
Build-Dependency `
|
||||
-Script "zlib" `
|
||||
-Outputs @("zlib.lib")
|
||||
|
||||
30
scripts/build-tinycc.ps1
Normal file
30
scripts/build-tinycc.ps1
Normal file
@@ -0,0 +1,30 @@
|
||||
$ErrorActionPreference = 'Stop' # Setting strict mode, similar to 'set -euo pipefail' in bash
|
||||
. (Join-Path $PSScriptRoot "env.ps1")
|
||||
|
||||
Push-Location (Join-Path $BUN_DEPS_DIR 'tinycc')
|
||||
try {
|
||||
cd win32
|
||||
Run .\build-tcc.bat -clean
|
||||
cd ..
|
||||
|
||||
Set-Content -Path config.h -Value @"
|
||||
#define TCC_VERSION "$(Get-Content VERSION)"
|
||||
#define TCC_GITHASH "$(git rev-parse --short HEAD)"
|
||||
#define CONFIG_TCCDIR "$((Get-Location).Path.Replace('\', '/'))"
|
||||
#define CONFIG_TCC_PREDEFS 1
|
||||
#ifdef TCC_TARGET_X86_64
|
||||
#define CONFIG_TCC_CROSSPREFIX "$PX%-"
|
||||
#endif
|
||||
"@
|
||||
|
||||
Run clang-cl -DTCC_TARGET_PE -DTCC_TARGET_X86_64 config.h -DC2STR -o c2str.exe conftest.c
|
||||
Run .\c2str.exe .\include\tccdefs.h tccdefs_.h
|
||||
|
||||
# TODO: -MT
|
||||
Run clang-cl libtcc.c -o tcc.obj "-DTCC_TARGET_PE" "-DTCC_TARGET_X86_64" "-O2" "-W2" "-Zi" "-MD" "-GS-" "-c"
|
||||
Run lib "tcc.obj" "-OUT:tcc.lib"
|
||||
|
||||
Copy-Item tcc.obj $BUN_DEPS_OUT_DIR/tcc.lib
|
||||
|
||||
Write-Host "-> tcc.lib"
|
||||
} finally { Pop-Location }
|
||||
Reference in New Issue
Block a user