Skip to content

Commit

Permalink
Fixup [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 committed May 21, 2024
1 parent 8307364 commit ebcbaf1
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 47 deletions.
16 changes: 12 additions & 4 deletions 1k/1kiss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ $options = @{
dll = $false
u = $false # whether delete 1kdist cross-platform prebuilt folder: path/to/_x
dm = $false # dump compiler preprocessors
i = $false # perform install
}

$optName = $null
Expand Down Expand Up @@ -1837,16 +1838,23 @@ if (!$setupOnly) {

# step4. build
# apply additional build options
$BUILD_ALL_OPTIONS += "--parallel"
$BUILD_ALL_OPTIONS += "$($options.j)"
$BUILD_ALL_OPTIONS += "--parallel", "$($options.j)"

if (!$cmake_target) { $cmake_target = $options.t }
if ($cmake_target) { $BUILD_ALL_OPTIONS += '--target', $cmake_target }
$1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count)

# forward non-cmake args to underlaying build toolchain, must at last
if (($cmake_generator -eq 'Xcode') -and !$BUILD_ALL_OPTIONS.Contains('--verbose')) {
$BUILD_ALL_OPTIONS += '--', '-quiet'
}
$1k.println("BUILD_ALL_OPTIONS=$BUILD_ALL_OPTIONS, Count={0}" -f $BUILD_ALL_OPTIONS.Count)

$1k.println("cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS")
cmake --build $BUILD_DIR $BUILD_ALL_OPTIONS | Out-Host

if ($options.i) {
$install_args = @($BUILD_DIR, '--config', $optimize_flag)
cmake --install $install_args | Out-Host
}
}
}
else {
Expand Down
25 changes: 18 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function mkdirs($path) {
}
}

function sremove($path) {
if (Test-Path $path) { Remove-Item $path -Recurse -Force }
}

# determine build lib list
if (!$libs) {
$libs = @(
Expand Down Expand Up @@ -209,6 +213,9 @@ Foreach ($lib_name in $libs) {
&$patch_script $lib_src
}

$install_script = Join-Path $_1k_root "src/$lib_name/install1.ps1"
$has_custom_install = (Test-Path $install_script)

# build
Push-Location $lib_src
$install_dir = Join-Path $install_root $lib_name
Expand All @@ -225,14 +232,19 @@ Foreach ($lib_name in $libs) {
}

$_config_options += "-DCMAKE_INSTALL_PREFIX=$install_dir"

if ($compiler_dumped) {
&$1k_script -p $target_os -a $target_cpu -xc $_config_options -xb '--target', 'install' @forward_args
$evaluated_args = @()
if ($build_conf.cb_target) {
$evaluated_args += '-t', $build_conf.cb_target
}
if (!$has_custom_install) {
$evaluated_args += '-i'
}
else {
&$1k_script -p $target_os -a $target_cpu -xc $_config_options -xb '--target', 'install' @forward_args -dm
if (!$compiler_dumped) {
$evaluated_args += '-dm'
$compiler_dumped = $true
}

&$1k_script -p $target_os -a $target_cpu -xc $_config_options @forward_args @evaluated_args
}
elseif ($is_gn) {
&$1k_script -p $target_os -a $target_cpu -xc $_config_options -xt 'gn' -t "$($build_conf.cb_target)" @forward_args
Expand All @@ -248,8 +260,7 @@ Foreach ($lib_name in $libs) {
Pop-Location

# custom install step
$install_script = Join-Path $_1k_root "src/$lib_name/install1.ps1"
if (Test-Path $install_script) {
if ($has_custom_install) {
&$install_script $install_dir $lib_src
}
# clean unnecessary files
Expand Down
4 changes: 2 additions & 2 deletions src/angle/install1.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$install_dir = $args[0]
$buildsrc_dir = $args[1]
$libsrc_dir = $args[1]

$buildout = Join-Path $Global:BUILD_DIR '/'

Expand All @@ -14,7 +14,7 @@ if ($Global:is_win_family) {
# copy includes
$inst_inc_dir = Join-Path $install_dir 'include'
mkdirs $inst_inc_dir
Copy-Item -Path $(Join-Path $buildsrc_dir 'include/*') -Destination $inst_inc_dir -Recurse -Force
Copy-Item -Path $(Join-Path $libsrc_dir 'include/*') -Destination $inst_inc_dir -Recurse -Force

# copy .lib
Copy-Item "${buildout}libGLESv2.dll.lib" "${inst_lib_dir}libGLESv2.dll.lib" -Force
Expand Down
8 changes: 3 additions & 5 deletions src/cares/clean1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ $install_dir = $args[0]
if ((Test-Path $install_dir -PathType Container)) {
Write-Output "Cleaning ${install_dir}..."
# Delete files what we don't want
Remove-Item "$install_dir/lib/cmake" -Recurse -Force
Remove-Item "$install_dir/lib/pkgconfig" -Recurse -Force
if (Test-Path "$install_dir/share" -PathType Container) {
Remove-Item "$install_dir/share" -Recurse -Force
}
sremove "$install_dir/lib/cmake"
sremove "$install_dir/lib/pkgconfig"
sremove "$install_dir/share"
}
8 changes: 4 additions & 4 deletions src/curl/clean1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ if ((Test-Path $install_dir -PathType Container)) {
Write-Output "Cleaning ${install_dir}..."
# Delete files what we don't want
if($IsWindows) {
Remove-Item "$install_dir\bin\curl-config"
sremove "$install_dir\bin\curl-config"
} else {
Remove-Item "$install_dir\bin" -Recurse -Force
sremove "$install_dir\bin"
}
Remove-Item "$install_dir\lib\cmake" -Recurse -Force
Remove-Item "$install_dir\lib\pkgconfig" -Recurse -Force
sremove "$install_dir\lib\cmake"
sremove "$install_dir\lib\pkgconfig"
}
6 changes: 3 additions & 3 deletions src/jpeg-turbo/clean1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ if ((Test-Path $install_dir -PathType Container)) {
Write-Output "Cleaning ${install_dir}..."
# Delete files what we don't want
# Remove-Item "$install_dir\bin" -recurse
Remove-Item "$install_dir\share" -recurse
Remove-Item "$install_dir\lib\cmake" -recurse
Remove-Item "$install_dir\lib\pkgconfig" -recurse
sremove "$install_dir\share"
sremove "$install_dir\lib\cmake"
sremove "$install_dir\lib\pkgconfig"
ls -R "$install_dir"
}
6 changes: 3 additions & 3 deletions src/llvm/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repo: https://github.com/llvm/llvm-project.git
ver: 16.0.6
ver: 15.0.7
tag_prefix: llvmorg-
tag_dot2ul: false
cb_tool: cmake
cb_target: libclang
targets: win32,linux,osx
archs: x64,arm64
options: -S llvm -DLLVM_ENABLE_PROJECTS=clang
options: -S llvm -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_CXX_STANDARD=17
options_unix: -DCMAKE_BUILD_TYPE=Release -DCMAKE_PLATFORM_NO_VERSIONED_SONAME=1
options_msw: -Thost=x64
options_msw: -Thost=x64 -DCMAKE_C_FLAGS=/source-charset:utf-8 -DCMAKE_CXX_FLAGS=/source-charset:utf-8
4 changes: 4 additions & 0 deletions src/llvm/clean1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ $install_dir = $args[0]

if ((Test-Path $install_dir -PathType Container)) {
echo "[windows] Cleaning ${install_dir}..."
sremove (Join-Path $install_dir 'include')
sremove (Join-Path $install_dir 'lib/*.lib')
sremove (Join-Path $install_dir 'lib/*.a')
sremove (Join-Path $install_dir 'bin/*.exe')
ls -R "$install_dir"
}
7 changes: 7 additions & 0 deletions src/llvm/install1.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$install_dir = $args[0]
# $libsrc_dir = $args[1]

$artifact_path = @('Release\bin\libclang.dll', 'lib\libclang.so', 'Release\lib\libclang.dylib')[$HOST_OS]
$install_dest = (Join-Path $install_dir (@('lib', 'bin')[$IsWin]))
mkdirs $install_dest
Copy-Item (Join-Path $BUILD_DIR "$artifact_path") $install_dest
36 changes: 18 additions & 18 deletions src/luajit/install1.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$install_dir = $args[0]
$buildsrc_dir = $args[1]
$libsrc_dir = $args[1]

if ($IsWindows) {
# copy prebuilt luajit manually
Expand All @@ -8,17 +8,17 @@ if ($IsWindows) {
mkdir "$install_dir\bin" -Force
mkdir "$install_dir\bin\jit" -Force

Copy-Item "$buildsrc_dir\src\lua51.lib" "$install_dir\lib\lua51.lib" -Force
Copy-Item "$buildsrc_dir\src\lua51.dll" "$install_dir\bin\lua51.dll" -Force
Copy-Item "$buildsrc_dir\src\luajit.exe" "$install_dir\bin\luajit.exe" -Force
Copy-Item -Path "$buildsrc_dir\src\jit\*.lua" -Destination "$install_dir\bin\jit" -Recurse -Force
Copy-Item "$libsrc_dir\src\lua51.lib" "$install_dir\lib\lua51.lib" -Force
Copy-Item "$libsrc_dir\src\lua51.dll" "$install_dir\bin\lua51.dll" -Force
Copy-Item "$libsrc_dir\src\luajit.exe" "$install_dir\bin\luajit.exe" -Force
Copy-Item -Path "$libsrc_dir\src\jit\*.lua" -Destination "$install_dir\bin\jit" -Recurse -Force

Copy-Item "$buildsrc_dir\src\lauxlib.h" "$install_dir\include\lauxlib.h" -Force
Copy-Item "$buildsrc_dir\src\lua.h" "$install_dir\include\lua.h" -Force
Copy-Item "$buildsrc_dir\src\lua.hpp" "$install_dir\include\lua.hpp" -Force
Copy-Item "$buildsrc_dir\src\luaconf.h" "$install_dir\include\luaconf.h" -Force
Copy-Item "$buildsrc_dir\src\luajit.h" "$install_dir\include\luajit.h" -Force
Copy-Item "$buildsrc_dir\src\lualib.h" "$install_dir\include\lualib.h" -Force
Copy-Item "$libsrc_dir\src\lauxlib.h" "$install_dir\include\lauxlib.h" -Force
Copy-Item "$libsrc_dir\src\lua.h" "$install_dir\include\lua.h" -Force
Copy-Item "$libsrc_dir\src\lua.hpp" "$install_dir\include\lua.hpp" -Force
Copy-Item "$libsrc_dir\src\luaconf.h" "$install_dir\include\luaconf.h" -Force
Copy-Item "$libsrc_dir\src\luajit.h" "$install_dir\include\luajit.h" -Force
Copy-Item "$libsrc_dir\src\lualib.h" "$install_dir\include\lualib.h" -Force

echo "[windows] list ${install_dir}..."
ls -R "$install_dir"
Expand All @@ -27,14 +27,14 @@ if ($IsWindows) {
mkdir "$install_dir/include"
mkdir "$install_dir/lib"

cp "$buildsrc_dir/src/libluajit.a" "$install_dir/lib/libluajit.a"
cp "$libsrc_dir/src/libluajit.a" "$install_dir/lib/libluajit.a"

cp "$buildsrc_dir/src/lauxlib.h" "$install_dir/include/lauxlib.h"
cp "$buildsrc_dir/src/lua.h" "$install_dir/include/lua.h"
cp "$buildsrc_dir/src/lua.hpp" "$install_dir/include/lua.hpp"
cp "$buildsrc_dir/src/luaconf.h" "$install_dir/include/luaconf.h"
cp "$buildsrc_dir/src/luajit.h" "$install_dir/include/luajit.h"
cp "$buildsrc_dir/src/lualib.h" "$install_dir/include/lualib.h"
cp "$libsrc_dir/src/lauxlib.h" "$install_dir/include/lauxlib.h"
cp "$libsrc_dir/src/lua.h" "$install_dir/include/lua.h"
cp "$libsrc_dir/src/lua.hpp" "$install_dir/include/lua.hpp"
cp "$libsrc_dir/src/luaconf.h" "$install_dir/include/luaconf.h"
cp "$libsrc_dir/src/luajit.h" "$install_dir/include/luajit.h"
cp "$libsrc_dir/src/lualib.h" "$install_dir/include/lualib.h"

echo "[unix] list ${install_dir}..."
}
2 changes: 1 addition & 1 deletion src/zlib/clean1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $install_dir = $args[0]
if ((Test-Path $install_dir -PathType Container)) {
Write-Output "Cleaning ${install_dir}..."
# Delete files what we don't want
Remove-Item "$install_dir/share" -Recurse -Force
sremove "$install_dir/share"
}

0 comments on commit ebcbaf1

Please sign in to comment.