From: Doug Coleman Date: Fri, 15 Dec 2023 19:18:21 +0000 (-0600) Subject: build-from-source: move version getter words to build-from-source X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=f5bc77afea55b83eea8e0235fb68ba71d2ace442 build-from-source: move version getter words to build-from-source --- diff --git a/extra/build-from-source/build-from-source.factor b/extra/build-from-source/build-from-source.factor index eb79f293c7..336ecb22d0 100644 --- a/extra/build-from-source/build-from-source.factor +++ b/extra/build-from-source/build-from-source.factor @@ -1,12 +1,12 @@ ! 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 ] @@ -244,3 +244,120 @@ ERROR: no-output-file path ; [ "." 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 ; diff --git a/extra/build-from-source/windows/windows.factor b/extra/build-from-source/windows/windows.factor index bc8983ef73..4282b91803 100644 --- a/extra/build-from-source/windows/windows.factor +++ b/extra/build-from-source/windows/windows.factor @@ -26,17 +26,6 @@ IN: build-from-source.windows : 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 [ [ @@ -51,10 +40,6 @@ IN: build-from-source.windows ] 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 [ [ @@ -65,10 +50,6 @@ IN: build-from-source.windows "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 [ [ @@ -83,10 +64,6 @@ IN: build-from-source.windows ] 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 @@ -113,10 +90,6 @@ IN: build-from-source.windows : 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 @@ -134,15 +107,6 @@ IN: build-from-source.windows } 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 [ [ @@ -159,12 +123,6 @@ IN: build-from-source.windows ] 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 [ [ @@ -190,10 +148,6 @@ IN: build-from-source.windows ] 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 @@ -227,14 +181,6 @@ IN: build-from-source.windows ] 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 [ [ @@ -249,10 +195,6 @@ IN: build-from-source.windows ] 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 [ [ @@ -267,12 +209,6 @@ IN: build-from-source.windows ] 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 [ @@ -283,10 +219,6 @@ IN: build-from-source.windows "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 [ @@ -302,10 +234,6 @@ IN: build-from-source.windows ] 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 @@ -321,22 +249,12 @@ IN: build-from-source.windows "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 [ [ @@ -351,10 +269,6 @@ IN: build-from-source.windows ] 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 @@ -362,10 +276,6 @@ IN: build-from-source.windows "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 [ [ @@ -381,10 +291,6 @@ IN: build-from-source.windows ] 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 [ [ @@ -400,10 +306,6 @@ IN: build-from-source.windows ] 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 [ [ @@ -418,10 +320,6 @@ IN: build-from-source.windows ] 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 @@ -429,10 +327,6 @@ IN: build-from-source.windows "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" [ @@ -449,17 +343,6 @@ IN: build-from-source.windows ] 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? [