! Copyright (C) 2023 Doug Coleman.
! See https://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs calendar calendar.format cli.git
-combinators combinators.extras combinators.short-circuit
-continuations formatting github http.client io io.directories
-io.encodings.utf8 io.files io.files.info io.launcher
-io.pathnames json kernel layouts math namespaces
-namespaces.extras semver sequences sequences.extras sorting
-sorting.human sorting.specification splitting system unicode ;
+combinators combinators.short-circuit continuations formatting
+github html.parser html.parser.analyzer http.client io
+io.directories io.encodings.string io.encodings.utf8 io.files
+io.launcher io.pathnames json kernel layouts math namespaces
+semver sequences sequences.extras sorting sorting.human
+sorting.specification splitting system unicode ;
IN: build-from-source
INITIALIZED-SYMBOL: use-gitlab-git-uris [ f ]
[ "." split1-last nip [ digit? ] all? ] filter
latest-python ;
: latest-python3 ( -- tag ) python-tags tags>latest-python3 ;
+
+: latest-fftw ( -- path )
+ "https://ftp.fftw.org/pub/fftw/" [
+ http-get nip
+ parse-html find-links concat
+ [ name>> text = ] filter
+ [ text>> ] map
+ [ "fftw-" head? ] filter
+ [ ".tar.gz" tail? ] filter
+ human-sort last
+ ] keep prepend-path ;
+
+: latest-libressl ( -- path )
+ "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/" [
+ http-get nip parse-html find-links concat
+ [ name>> text = ] filter
+ [ text>> ] map
+ [ "libressl-" head? ] filter
+ [ ".tar.gz" tail? ] filter last
+ ] keep prepend ;
+
+: latest-pcre-tar-gz ( -- path )
+ "https://ftp.exim.org/pub/pcre/" [
+ http-get nip parse-html find-links concat
+ [ name>> text = ] filter [ text>> ] map
+ [ "pcre-" head? ] filter
+ [ ".tar.gz" tail? ] filter last
+ ] keep prepend ;
+
+: cairo-versions ( -- version )
+ "https://gitlab.freedesktop.org/api/v4/projects/956/repository/tags"
+ http-get nip utf8 decode json> [ "name" of ] map ;
+
+: blas-versions ( -- seq )
+ "xianyi" "OpenBLAS" "v" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: duckdb-versions ( -- seq )
+ "duckdb" "duckdb" "v" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: grpc-versions ( -- seq )
+ "grpc" "grpc" "v" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: pcre2-versions ( -- seq )
+ "PCRE2Project" "pcre2" "" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: lz4-versions ( -- seq )
+ "lz4" "lz4" "v" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: openal-versions ( -- seq )
+ "kcat" "openal-soft" "" list-repository-tags-matching
+ tag-refs
+ [ [ digit-or-dot? ] all? ] filter
+ human-sort ;
+
+: openssl-versions ( -- seq )
+ "openssl" "openssl" "openssl-" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: postgres-versions ( -- seq )
+ "postgres" "postgres" "REL_" list-repository-tags-matching
+ tag-refs
+ ! [ "_" split1-last nip [ digit? ] all? ] filter ! no RC1 or BETA1
+ human-sort ;
+
+: raylib-versions ( -- seq )
+ "raysan5" "raylib" "" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: raygui-versions ( -- seq )
+ "raysan5" "raygui" "" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: ripgrep-versions ( -- seq )
+ "BurntSushi" "ripgrep" "" list-repository-tags-matching
+ tag-refs
+ [ [ digit-or-dot? ] all? ] filter
+ human-sort ;
+
+: snappy-versions ( -- seq )
+ "google" "snappy" "" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: sqlite-versions ( -- seq )
+ "sqlite" "sqlite" "version-" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: winflexbison-versions ( -- seq )
+ "lexxmark" "winflexbison" "v" list-repository-tags-matching
+ tag-refs [ "v." head? ] reject human-sort ;
+
+: yaml-versions ( -- seq )
+ "yaml" "libyaml" "" list-repository-tags-matching
+ tag-refs [ [ digit-or-dot? ] all? ] filter human-sort ;
+
+: zeromq-versions ( -- seq )
+ "zeromq" "libzmq" "" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: zlib-versions ( -- seq )
+ "madler" "zlib" "v" list-repository-tags-matching
+ tag-refs human-sort ;
+
+: zstd-versions ( -- seq )
+ "facebook" "zstd" "v" list-repository-tags-matching
+ tag-refs human-sort
+ [
+ {
+ [ length 2 >= ]
+ [ "v" head? ]
+ [ second digit? ]
+ } 1&&
+ ] filter ;
: check-cmake ( -- ) { "cmake" "-h" } try-process ;
: check-msbuild ( -- ) { "msbuild" "-h" } try-process ;
-: latest-fftw ( -- path )
- "https://ftp.fftw.org/pub/fftw/" [
- http-get nip
- parse-html find-links concat
- [ name>> text = ] filter
- [ text>> ] map
- [ "fftw-" head? ] filter
- [ ".tar.gz" tail? ] filter
- human-sort last
- ] keep prepend-path ;
-
: build-fftw-dll ( -- )
latest-fftw [
[
] with-build-directory
] with-tar-gz ;
-: winflexbison-versions ( -- seq )
- "lexxmark" "winflexbison" "v" list-repository-tags-matching
- tag-refs [ "v." head? ] reject human-sort ;
-
: build-winflexbison ( -- )
"lexxmark" "winflexbison" winflexbison-versions last [
[
"bin/Release/win_flex.exe" "flex.exe" copy-vm-file-as
] with-github-worktree-tag ;
-: blas-versions ( -- seq )
- "xianyi" "OpenBLAS" "v" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-blas ( -- )
"xianyi" "OpenBLAS" blas-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: openssl-versions ( -- seq )
- "openssl" "openssl" "openssl-" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-openssl-32-dlls ( -- )
"openssl" "openssl" openssl-versions last [
check-perl
: build-openssl-dlls ( -- )
32-bit? [ build-openssl-32-dlls ] [ build-openssl-64-dlls ] if ;
-: cairo-versions ( -- version )
- "https://gitlab.freedesktop.org/api/v4/projects/956/repository/tags"
- http-get nip utf8 decode json> [ "name" of ] map ;
-
: build-cairo-dll ( -- )
"gitlab.freedesktop.org" "cairo" "cairo" cairo-versions first [
qw{ meson setup --force-fallback-for=freetype2,fontconfig,zlib,expat,expat_dep build } try-process
} delete-output-files
] with-gitlab-worktree-tag ;
-: latest-libressl ( -- path )
- "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/" [
- http-get nip parse-html find-links concat
- [ name>> text = ] filter
- [ text>> ] map
- [ "libressl-" head? ] filter
- [ ".tar.gz" tail? ] filter last
- ] keep prepend ;
-
: build-libressl-dlls ( -- )
latest-libressl [
[
] with-build-directory
] with-tar-gz ;
-: openal-versions ( -- seq )
- "kcat" "openal-soft" "" list-repository-tags-matching
- tag-refs
- [ [ digit-or-dot? ] all? ] filter
- human-sort ;
-
: build-openal-dll ( -- )
"kcat" "openal-soft" openal-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: grpc-versions ( -- seq )
- "grpc" "grpc" "v" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-grpc-dll ( -- )
"grpc" "grpc" grpc-versions last [
qw{ git submodule init } try-process
] with-build-directory-as
] with-github-worktree-tag ;
-: latest-pcre-tar-gz ( -- path )
- "https://ftp.exim.org/pub/pcre/" [
- http-get nip parse-html find-links concat
- [ name>> text = ] filter [ text>> ] map
- [ "pcre-" head? ] filter
- [ ".tar.gz" tail? ] filter last
- ] keep prepend ;
-
: build-pcre-dll ( -- )
latest-pcre-tar-gz [
[
] with-build-directory
] with-tar-gz ;
-: pcre2-versions ( -- seq )
- "PCRE2Project" "pcre2" "" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-pcre2-dll ( -- )
"PCRE2Project" "pcre2" pcre2-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: postgres-versions ( -- seq )
- "postgres" "postgres" "REL_" list-repository-tags-matching
- tag-refs
- ! [ "_" split1-last nip [ digit? ] all? ] filter ! no RC1 or BETA1
- human-sort ;
-
! choco install -y meson winflexbison3
: build-postgres-dll ( -- )
"postgres" "postgres" postgres-versions last [
"build/src/interfaces/libpq/libpq.dll" copy-output-file
] with-github-worktree-tag ;
-: raylib-versions ( -- seq )
- "raysan5" "raylib" "" list-repository-tags-matching
- tag-refs human-sort ;
-
! choco install -y glfw3
: build-raylib-dll ( -- )
"raysan5" "raylib" raylib-versions last [
] with-build-directory
] with-github-worktree-tag ;
-: raygui-versions ( -- seq )
- "raysan5" "raygui" "" list-repository-tags-matching
- tag-refs human-sort ;
-
:: build-raygui-dll ( -- )
"raysan5" "raygui" raygui-versions last [
"raysan5" "raylib" raylib-versions last github-tag-disk-checkout-path :> $raylib-dir
"raygui.dll" copy-output-file
] with-github-worktree-tag ;
-: ripgrep-versions ( -- seq )
- "BurntSushi" "ripgrep" "" list-repository-tags-matching
- tag-refs
- [ [ digit-or-dot? ] all? ] filter
- human-sort ;
-
: build-ripgrep ( -- )
"BurntSushi" "ripgrep" ripgrep-versions last [
qw{ cargo build --release } try-process
"target/release/rg.exe" copy-output-file
] with-github-worktree-tag ;
-: snappy-versions ( -- seq )
- "google" "snappy" "" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-snappy-dll ( -- )
"google" "snappy" snappy-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: sqlite-versions ( -- seq )
- "sqlite" "sqlite" "version-" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-sqlite-dll ( -- )
"sqlite" "sqlite" sqlite-versions last [
qw{ nmake /f Makefile.msc clean } try-process
"sqlite3.dll" copy-output-file
] with-github-worktree-tag ;
-: duckdb-versions ( -- seq )
- "duckdb" "duckdb" "v" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-duckdb-dll ( -- )
"duckdb" "duckdb" duckdb-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: yaml-versions ( -- seq )
- "yaml" "libyaml" "" list-repository-tags-matching
- tag-refs [ [ digit-or-dot? ] all? ] filter human-sort ;
-
: build-yaml-dll ( -- )
"yaml" "libyaml" yaml-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: zeromq-versions ( -- seq )
- "zeromq" "libzmq" "" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-zeromq-dll ( -- )
"zeromq" "libzmq" zeromq-versions last [
[
] with-build-directory
] with-github-worktree-tag ;
-: zlib-versions ( -- seq )
- "madler" "zlib" "v" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-zlib-dll ( -- )
"madler" "zlib" zlib-versions last [
qw{ nmake /f win32/Makefile.msc clean } try-process
"zlib1.dll" copy-output-file
] with-github-worktree-tag ;
-: lz4-versions ( -- seq )
- "lz4" "lz4" "v" list-repository-tags-matching
- tag-refs human-sort ;
-
: build-lz4 ( -- )
"lz4" "lz4" lz4-versions last [
"build/cmake" [
] with-directory
] with-github-worktree-tag ;
-: zstd-versions ( -- seq )
- "facebook" "zstd" "v" list-repository-tags-matching
- tag-refs human-sort
- [
- {
- [ length 2 >= ]
- [ "v" head? ]
- [ second digit? ]
- } 1&&
- ] filter ;
-
: build-zstd-dll ( -- )
"facebook" "zstd" zstd-versions last [
32-bit? [