]> gitweb.factorcode.org Git - factor.git/commitdiff
build-from-source: ensure output files exist and compile fftw
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 15 Jan 2023 20:57:19 +0000 (14:57 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 15 Jan 2023 20:57:19 +0000 (14:57 -0600)
extra/build-from-source/build-from-source.factor
extra/build-from-source/windows/windows.factor

index 275bc7844f73b4d2c299aa40b8e1dcc097cc7ef3..4b88e89516221cd0cb51cd6eea531ec53bc116d3 100644 (file)
@@ -20,8 +20,9 @@ IN: build-from-source
     recursive-directory-files
     [ file-name >lower ".dll" tail? ] filter ;
 
+ERROR: no-output-file path ;
 : copy-output-file-as ( name new-name -- )
-    [ prepend-current-path ]
+    [ prepend-current-path dup file-exists? [ no-output-file ] unless ]
     [ dll-out-directory prepend-path ] bi* copy-file ;
 
 : copy-vm-file-as ( name new-name -- )
index 47931b8eb19bf64155ec252cbf717a602b2e8157..f3f6c157df422ebe76bef283484840b296c61c9d 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors build-from-source environment html.parser
 html.parser.analyzer http.client io.directories
 io.encodings.utf8 io.files io.files.temp io.launcher
-io.pathnames kernel multiline sequences windows.shell32 ;
+io.pathnames kernel multiline sequences sorting.human
+sorting.slots windows.shell32 ;
 IN: build-from-source.windows
 
 ! From `choco install -y nasm`
@@ -20,6 +21,26 @@ IN: build-from-source.windows
 : check-cmake ( -- ) { "cmake" "-h" } try-process ;
 : check-msbuild ( -- ) { "msbuild" "-h" } try-process ;
 
+: latest-fftw ( -- path )
+    "http://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-by last
+    ] keep prepend-path ;
+
+: build-fftw ( -- )
+    latest-fftw [
+        [
+            { "cmake" "-DBUILD_SHARED_LIBS=ON" ".." } try-process
+            { "msbuild" "fftw.sln" "/m" "/property:Configuration=Release" } try-process
+            "Release/fftw3.dll" copy-output-file
+        ] with-build-directory
+    ] with-tar-gz ;
+
 : build-winflexbison ( -- )
     "https://github.com/lexxmark/winflexbison.git" [
         [