From 3a69d8786e411d0867a698f50acf1efd04bee35d Mon Sep 17 00:00:00 2001 From: Elbert van de Put Date: Sun, 26 Dec 2021 15:38:11 +0100 Subject: [PATCH] build: Implement building multithreaded for windows. --- .github/workflows/release.yml | 6 +++--- .github/workflows/tests.yml | 6 +++--- .gitignore | 1 + Makefile | 6 ++++-- scripts/feature-test-pthreads | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db8aebb0..ca8cf499 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,17 +97,17 @@ jobs: sudo docker run --rm dockcross/windows-x64 > dockcross-windows-x64 cat dockcross-windows-x64 chmod +x dockcross-windows-x64 - wget https://curl.haxx.se/download/curl-7.69.1.tar.gz + wget https://curl.haxx.se/download/curl-7.80.0.tar.gz tar xzf curl-* CURL_SRC=curl-* - ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && ./configure --prefix="/work/deps/curl" --host=x86_64-w64-mingw32.static --with-winssl --disable-dependency-tracking --disable-pthreads --disable-pthreads --enable-threaded-resolver' + ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && ./configure --prefix="/work/deps/curl" --host=x86_64-w64-mingw32.static --with-schannel --disable-dependency-tracking --enable-threaded-resolver --disable-imap --disable-pop3 --disable-smtp --disable-ldap --disable-mqtt --disable-smb' ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && make' ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && make install' - name: Build Release run: | mkdir -p build/bin - ./dockcross-windows-x64 make install NO_PTHREADS=1 STATIC=true EXE=true PREFIX=build + ./dockcross-windows-x64 make install STATIC=true EXE=true PREFIX=build - uses: actions/upload-artifact@v1 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e3ef4431..329e8894 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,13 +43,13 @@ jobs: sudo docker run --rm dockcross/windows-x64 > dockcross-windows-x64 cat dockcross-windows-x64 chmod +x dockcross-windows-x64 - wget https://curl.haxx.se/download/curl-7.69.1.tar.gz + wget https://curl.haxx.se/download/curl-7.80.0.tar.gz tar xzf curl-* CURL_SRC=curl-* - ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && ./configure --prefix="/work/deps/curl" --host=x86_64-w64-mingw32.static --with-winssl --disable-dependency-tracking --disable-pthreads --disable-pthreads --enable-threaded-resolver' + ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && ./configure --prefix="/work/deps/curl" --host=x86_64-w64-mingw32.static --with-schannel --disable-dependency-tracking --enable-threaded-resolver --disable-imap --disable-pop3 --disable-smtp --disable-ldap --disable-mqtt --disable-smb' ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && make' ./dockcross-windows-x64 bash -c 'cd '"$CURL_SRC"' && make install' - name: Run Tests run: | ## if builds pass then its passing for now - ./dockcross-windows-x64 make all NO_PTHREADS=1 STATIC=true EXE=true + ./dockcross-windows-x64 make all STATIC=true EXE=true diff --git a/.gitignore b/.gitignore index aaab4cdb..fa21d235 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ clib clib-install clib-search +*.exe *.o *.d tmp/ diff --git a/Makefile b/Makefile index 286660f3..35d5528c 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,13 @@ MAKEFILES = $(wildcard deps/*/Makefile) export CC +CFLAGS += -std=c99 -Ideps -Wall -Wno-unused-function -U__STRICT_ANSI__ + ifdef STATIC - CFLAGS += -DCURL_STATICLIB -std=c99 -Ideps -Wall -Wno-unused-function -U__STRICT_ANSI__ $(shell deps/curl/bin/curl-config --cflags) + CFLAGS += -DCURL_STATICLIB $(shell deps/curl/bin/curl-config --cflags) LDFLAGS += -static $(shell deps/curl/bin/curl-config --static-libs) else - CFLAGS += -std=c99 -Ideps -Wall -Wno-unused-function -U__STRICT_ANSI__ $(shell curl-config --cflags) + CFLAGS += $(shell curl-config --cflags) LDFLAGS += $(shell curl-config --libs) endif diff --git a/scripts/feature-test-pthreads b/scripts/feature-test-pthreads index 5ace8915..c0e099a8 100755 --- a/scripts/feature-test-pthreads +++ b/scripts/feature-test-pthreads @@ -4,5 +4,5 @@ echo '#include ' && echo 'void *f(void *a) { return 0; }' && echo 'int main(void) { pthread_t t; return pthread_create(&t, 0, f, 0); }'; -} | ${CC:-cc} -o /dev/null -xc -pthread - 2>/dev/null +} | ${CC:-cc} -o pthread_test -xc -pthread - 2>/dev/null && rm pthread_test exit $?