11import { BuildOptions , run , unarchive } from "brewkit" ;
22
3- //TODO has more deps that it vendors
4- // use --sysmem-libs to use them
3+ //NOTE we statically link everything because we have a policy
4+ // where build tools have no deps to prevent their deps inadvertently
5+ // leaking into other builds
56
67export default async function ( { prefix, deps, version } : BuildOptions ) {
78 await unarchive ( `https://github.com/Kitware/CMake/releases/download/v${ version } /cmake-${ version } .tar.gz` ) ;
89
9- const extra_args = Deno . build . os != "darwin"
10- ? `-DZLIB_LIBRARY=${ deps [ "zlib.net" ] . prefix } /lib/libz.so
11- -DZLIB_INCLUDE_DIR=${ deps [ "zlib.net" ] . prefix } /include
12- -DCURL_LIBRARY=${ deps [ "curl.se" ] . prefix } /lib/libcurl.so
13- -DCURL_INCLUDE_DIR=${ deps [ "curl.se" ] . prefix } /include
14- -DBZIP2_LIBRARIES=${ deps [ "sourceware.org/bzip2" ] . prefix } /lib/libbz2.so
15- -DBZIP2_INCLUDE_DIR=${ deps [ "sourceware.org/bzip2" ] . prefix } /include`
16- : "" ;
17-
18- if ( Deno . build . os != "windows" ) {
10+ try {
11+ env_include ( "cmake.org" ) ;
12+ } catch {
1913 run `./bootstrap
2014 --prefix=${ prefix }
2115 --docdir=/share/doc
@@ -26,18 +20,21 @@ export default async function ({ prefix, deps, version }: BuildOptions) {
2620 --
2721 -DCMake_BUILD_LTO=ON
2822 -DCMAKE_BUILD_TYPE=Release
29- -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
30- ${ extra_args }
3123 ` ;
32- run `make --jobs ${ navigator . hardwareConcurrency } install` ;
33- } else {
34- run `cmake . -B build
35- -DCMAKE_INSTALL_PREFIX=${ prefix }
36- -DCMAKE_BUILD_TYPE=Release
37- ${ extra_args } ` ;
38- run `cmake --build build --config Release --target install --parallel ${ navigator . hardwareConcurrency } ` ;
3924 }
4025
26+ run `cmake
27+ -S .
28+ -B build
29+ -DCMake_BUILD_LTO=ON
30+ -DCMAKE_INSTALL_PREFIX=${ prefix }
31+ -DCMAKE_BUILD_TYPE=Release` ;
32+ run `cmake
33+ --build build
34+ --config Release
35+ --target install
36+ --parallel` ;
37+
4138 // we have a “docs are on the Internet” policy
4239 prefix . share . join ( `cmake-${ version . marketing } /Help` ) . rm ( "rf" ) ;
4340}
0 commit comments