Browse Source

At last got Curl building from source on Windows

This was very very annoying.
master
Macoy Madson 2 years ago
parent
commit
ee5ca58746
  1. 4
      ReadMe.org
  2. 34
      src/Curl.cake

4
ReadMe.org

@ -92,12 +92,12 @@ Here are the known compatibility results, where blank means untested/unknown:
| Module | Linux x86_64 | Linux Arm v7 | Windows x64 | macOS |
|-----------------------------+--------------+--------------+-------------+-------|
| Allocator.cake | Yes | Yes | Yes | Yes |
| Aubio.cake | Yes | Probably | | |
| Aubio.cake | Yes | | | |
| AutoTest.cake | Yes | Yes | Yes | Yes |
| Config_ZigCompile.cake | Yes | | | |
| Config_ZigWindows.cake | Yes | | | |
| Cryptography.cake | Yes | | | |
| Curl.cake | Yes | | | |
| Curl.cake | Yes | | Yes | |
| DataBundle.cake | Yes | Yes | Yes | |
| Dependencies.cake | Yes | Yes | Yes | |
| Dictionary.cake | Yes | Yes | Yes | Yes |

34
src/Curl.cake

@ -7,7 +7,7 @@
(comptime-cond
('Unix (add-build-options "-DCURL_STATICLIB")
(add-c-search-directory-module "cakelisp_cache/CurlInstall/include/curl"))
('Windows (add-build-options "/D CURL_STATICLIB")
('Windows (add-build-options "/DCURL_STATICLIB")
(add-c-search-directory-module "Dependencies/curl/include/curl")))
(c-import "curl.h"))
@ -281,7 +281,7 @@
(defun-comptime build-curl (manager (& ModuleManager) module (* Module) &return bool)
(comptime-cond
('Windows
(when (fileExists "Dependencies/curl/lib/libcurl.a")
(when (fileExists "Dependencies/curl/builds/libcurl-vc-x64-release-static-ipv6-sspi-schannel/lib/libcurl_a.lib")
(return true))
;; I'm not sure why, but Windows refused to find cmd.exe without backslashes
@ -289,18 +289,17 @@
:in-directory "Dependencies/curl")
(Log "Failed to run buildconf.bat\n")
(return false))
;; TODO Hardcoded path will break on anyone else's machine
(var make-executable (* (const char)) "D:/Development/programs/tdm-gcc/bin/mingw32-make.exe")
(unless (fileExists make-executable)
(Log "Failed to find mingw32-make. Please install it on your path, e.g. via installing " \
"https://jmeubank.github.io/tdm-gcc/download/, then change src/Curl.cake make-executable\n")
(return false))
(run-process-sequential-or (make-executable "-j" "mingw32"
:in-directory "Dependencies/curl")
(Log "Failed to run mingw32-make\n")
;; Only https://medium.com/@farhabihelal/how-to-set-up-libcurl-on-visual-studio-2019-a9fdacce6945
;; was able to clarify that I should use the winbuild version. I'm not sure why it wasn't
;; present in the docs. Maybe it will be deprecated?
(run-process-sequential-or ("nmake.exe" "/f" "Makefile.vc" "mode=static"
:in-directory "Dependencies/curl/winbuild")
(Log "Failed to build curl with MSVC nmake\n")
(return false))
(unless (fileExists "Dependencies/curl/lib/libcurl.a")
(Log "Failed to find Dependencies/curl/lib/libcurl.a, despite its build returning success.\n")
(unless (fileExists "Dependencies/curl/builds/libcurl-vc-x64-release-static-ipv6-sspi-schannel/lib/libcurl_a.lib")
(Log "Failed to find Dependencies/curl/builds/libcurl-vc-x64-release-static-ipv6-sspi-schannel/lib/libcurl_a.lib,
despite its build returning success.\n")
(return false)))
('Unix
;; Already built?
@ -386,8 +385,13 @@
"Ws2_32.lib" ;; Win sockets
"Advapi32.lib" ;; Win cryptography
"Wldap32.lib" ;; LDAP
;; "D:/Development/programs/tdm-gcc/x86_64-w64-mingw32/lib/libmsvcrt.a" ;; TODO hard-coded path
"Dependencies/curl/lib/libcurl.a")))
"Crypt32.lib"
"Normaliz.lib"
"Dependencies/curl/builds/libcurl-vc-x64-release-static-ipv6-sspi-schannel/lib/libcurl_a.lib")
;; TODO: Static link via MT? Curl's makefile.vc will need to be updated for that
(add-build-options-global "/MD" "/EHsc")))
(add-dependency-git-submodule
clone-curl

Loading…
Cancel
Save