-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(windows): powershell script w/ link flags
- Loading branch information
Showing
4 changed files
with
51 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
# Save the current directory | ||
$currentDir = Get-Location | ||
|
||
# Define the LuaJIT extension directory | ||
$luaExtDir = Join-Path -Path $currentDir -ChildPath "ext\luajit" | ||
|
||
# Build LuaJIT unless $luaExtDir\lua51.lib exists | ||
if (-not (Test-Path -Path "$luaExtDir\lua51.lib")) { | ||
# Create a temporary directory | ||
$luaDir = New-Item -ItemType Directory -Force -Path ([System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()) | ||
|
||
# Clone LuaJIT | ||
git clone https://github.com/LuaJIT/LuaJIT.git $luaDir | ||
|
||
# Change directory to LuaJIT src | ||
Set-Location -Path (Join-Path -Path $luaDir -ChildPath "src") | ||
|
||
# Build LuaJIT (dynamic) | ||
.\msvcbuild.bat | ||
Rename-Item -Path lua51.lib -NewName lua51-dynamic.lib | ||
|
||
# Build LuaJIT (static) | ||
.\msvcbuild.bat static | ||
|
||
# Copy files to $luaExtDir | ||
$null = New-Item -ItemType Directory -Force -Path $luaExtDir | ||
Copy-Item -Path lua51-dynamic.lib -Destination $luaExtDir | ||
Copy-Item -Path lua51.dll -Destination $luaExtDir | ||
Copy-Item -Path lua51.lib -Destination $luaExtDir | ||
|
||
# Copy jit.* modules to $luaExtDir\lua\jit | ||
$null = New-Item -ItemType Directory -Force -Path "$luaExtDir\lua" | ||
Move-Item -Path jit -Destination "$luaExtDir\lua" | ||
|
||
# Return to the original directory | ||
Set-Location -Path $currentDir | ||
|
||
# Remove the temporary directory | ||
Remove-Item -Path $luaDir -Recurse -Force | ||
|
||
Write-Output "Add the following to any crystal commands:" | ||
Write-Output " --link-flags=/LIBPATH:$luaExtDir" | ||
} |
This file was deleted.
Oops, something went wrong.