Compare commits

...

69 Commits

Author SHA1 Message Date
2e9d3818ba Small fix to our Unicode-aware version of the Curl_execpath() function. 2024-11-13 01:05:53 +01:00
7df958ca6b Fixed build of 'libtcp2' with new OpenSSL/QuicTLS version. 2024-11-12 20:29:46 +01:00
6298a0decc Updated patch for new 'libssh2' version. 2024-11-12 20:25:25 +01:00
788c86c9b5 Updated OpenSSL/QuicTLS to version 3.3.0. 2024-11-12 20:01:58 +01:00
1149dc6d25 More strict error handling in the Bash script. 2024-11-12 18:53:21 +01:00
6f156be298 Updated 'nghttp2' time patch for new version. 2024-11-12 18:52:08 +01:00
b29e588c9b Updated 'nghttp2', 'nghttp3' and 'ngtcp2' libraries to the latest version. 2024-11-12 18:20:56 +01:00
c3ce8d0f08 Updated 'libssh2' to the latest version. 2024-11-12 18:16:49 +01:00
049e548aea Simplified patches for new cURL version. 2024-11-12 17:31:27 +01:00
d506e23a97 Updated patch for new cURL version. 2024-11-12 16:37:38 +01:00
fa7e2e34da Updated cURL to version 8.11.0. 2024-11-12 14:33:17 +01:00
84eb1f1b03 Updated cURL to version 8.10.1. 2024-09-18 19:10:08 +02:00
7d5c3e72f3 Also create an artifact for the build logs. 2024-09-16 00:28:27 +02:00
0f8bb9bb40 Added workflow for GitHub actions. 2024-09-16 00:23:06 +02:00
df5824eb80 Updated the nghttp2/3 and ngtcp2 libraries. 2024-09-13 22:03:01 +02:00
d0ff7e2ad5 Removed an obsolete option. 2024-09-13 21:33:42 +02:00
589e0b387b Updated patch for new cURL version. 2024-09-13 21:32:46 +02:00
d18092c62a No longer explicitly add "-municode" to the LDFLAGS and remove the Configure workaround. We now rely on "--enable-windows-unicode" to sneak in "-municode" in the final build stage. 2024-09-13 20:35:14 +02:00
4cf4be38be OpenSSL updated to version 3.1.7-quic1. 2024-09-13 00:43:14 +02:00
8985c8134b Updated cURL to version 8.10.0. 2024-09-13 00:35:16 +02:00
cd652d4792 Updated patch for new cURL version. 2024-08-01 22:33:17 +02:00
e8f13cabba Updated some dependencies to the latest version. 2024-08-01 21:46:57 +02:00
ad6ed9e244 Updated cURL to version 8.9.1. 2024-08-01 21:31:57 +02:00
ae6bcdff72 Updated patch for new cURL version. 2024-08-01 21:29:19 +02:00
fe0f7f715d Updated cURL to version 8.9.0. 2024-08-01 21:15:14 +02:00
c45f603755 Workaround for building libgsasl with newer compiler versions. 2024-05-26 20:19:49 +02:00
b767f9c0f8 Update nghttp2 library. 2024-05-26 16:04:45 +02:00
bf0b902069 Updated cURL to version 8.8.0 + updated patch for new cURL version. 2024-05-26 16:00:47 +02:00
136a4e44e6 Updated "nghttp3" and "ngtcp2" libraries. 2024-05-12 20:36:20 +02:00
2f64676d3c Library "nghttp2" has been updated + CA certificates have been updated. 2024-04-14 22:06:30 +02:00
262a040081 Added detailed install instructions to the README file. 2024-04-14 18:07:32 +02:00
c2e27951e3 Library "gettex" library has been updated. 2024-04-01 18:25:32 +02:00
00cbe7bb85 Updated cURL to version 8.7.1 + updated nghttp2 and ngtcp2 libraries. 2024-03-29 13:44:14 +01:00
475df78798 Workaround for building OpenSSL 3.x with 64-Bit MinGW-w64. 2024-02-18 17:41:03 +01:00
6ba2f3adb9 OpenSSL updated to version 3.1.5-quic1. 2024-02-18 15:44:41 +01:00
efd438e936 Implemented checksum verification of downloaded packages. 2024-02-18 13:56:16 +01:00
09ef38e277 Small fix. 2024-02-12 00:29:35 +01:00
04b711ec1d Implemented some additional checks. 2024-02-11 01:05:17 +01:00
25a04525eb Improved handling of paths. 2024-02-06 23:10:30 +01:00
4c028b351d Updated patch for new curl version. 2024-02-06 22:48:39 +01:00
5d80246e88 Also build libpsl, because it is now required by cURL. 2024-02-06 00:19:33 +01:00
687881ea86 Updated cURL to version 8.6.0 (2024-01-31). 2024-02-05 23:52:07 +01:00
f7ee6be8ea Small code refactoring. 2023-12-08 17:14:32 +01:00
ce235738e6 Added README file. 2023-12-08 17:14:32 +01:00
d9b8e0a5f1 Workaround for use of GetTickCount64() in nghttp2 library. 2023-12-07 19:00:55 +01:00
eacdcf6cd9 Added .gitattributes file to force LF line-endings. 2023-12-07 15:43:31 +01:00
5c7c02f159 Make sure that HAVE_WRITABLE_ARGV is defined. 2023-12-07 15:43:30 +01:00
d1db4a3e39 Update patches for new cURL version. 2023-12-07 15:43:30 +01:00
612ca15de9 Updated cURL to version 8.5.0 (2023-12-06). 2023-12-07 01:54:41 +01:00
6b71627585 Reverted to previous version. 2023-10-15 17:48:56 +02:00
80f368c2b8 Workaround for "Failure writing output to destination" error on Windows XP. 2023-10-15 16:43:01 +02:00
1f902c076e Updated patch for new cURL version. 2023-10-14 14:50:13 +02:00
51b38b822a Updated cURL to version 8.4.0 (2023-10-11) + updated nghttp2, libidn2 and gettext. 2023-10-13 23:59:43 +02:00
62247915b0 Updated brotli to latest version + cURL build fix for brotli v1.1.0+. 2023-09-25 22:52:26 +02:00
7bfb0ac1d8 Updated zstd and brotli + workaround for official zstd release .tar.gz file being broken. 2023-09-23 21:05:57 +02:00
73183ff0ff Updated patch for new SSH2 version. 2023-09-23 20:46:06 +02:00
147599a189 Updated patch for new cURL version. 2023-09-23 20:41:43 +02:00
ab8451f4ac Updated nghttp2 and nghttp3. 2023-09-23 19:50:04 +02:00
80b4752801 Updated OpenSSL+QUIC. 2023-09-23 19:12:33 +02:00
991f616589 Updated zlib. 2023-09-23 17:38:57 +02:00
7bdba42c1f Updated to new cURL version. 2023-09-23 17:37:12 +02:00
e65899da32 Updated to new cURL version. 2023-06-04 22:49:29 +02:00
0ce95c8b80 Fixed an incompatible pointer type in cleanarg() function. 2023-04-04 22:52:45 +02:00
0793ad2791 Updated patch for new cURL version. 2023-04-04 20:15:38 +02:00
b3136acdcb Updated to new cURL version. 2023-04-02 20:14:49 +02:00
2c0f26828b Updated to new cURL version. 2022-12-29 02:56:45 +01:00
a0f09c49d7 Updated to new cURL version. 2022-11-01 21:22:15 +01:00
173d7840c0 Fixed URL. 2022-09-04 21:57:42 +02:00
9b340fad92 Updated to new cURL version. 2022-09-04 21:51:49 +02:00
20 changed files with 655 additions and 288 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.diff text eol=lf

57
.github/workflows/build-curl.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: "CI/CD"
on:
push:
branches: ['**']
pull_request:
release:
types: [published]
jobs:
build:
name: Build cURL
runs-on: windows-2019
strategy:
matrix:
include:
- flavor: "x86"
msystem: "MINGW32"
toolchain: "i686"
- flavor: "x64"
msystem: "MINGW64"
toolchain: "x86_64"
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: mingw-w64-${{ matrix.toolchain }}-toolchain base-devel cmake zip
- uses: actions/checkout@v4
- shell: msys2 {0}
run: ./build.sh
- uses: actions/upload-artifact@v4
with:
name: curl-windows-${{ matrix.flavor }}
path: build/curl-*.zip
- uses: actions/upload-artifact@v4
with:
name: build-log-${{ matrix.flavor }}
path: build/curl_build-*.log
release:
name: release files
if: ${{ github.event_name == 'release' }}
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: curl-windows-*
path: artifacts
merge-multiple: true
- uses: Roang-zero1/github-upload-release-artifacts-action@v2
with:
args: artifacts/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

13
.gitignore vendored
View File

@ -1,11 +1,2 @@
/*-src
/*-x64
/*-x86
/*.exe
/*.pem
/*.txt
/*.zip
/.bin
/.libs
/.local
/.release
/build/**/*
/_release

19
LICENSE.txt Normal file
View File

@ -0,0 +1,19 @@
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

59
README.md Normal file
View File

@ -0,0 +1,59 @@
# cURL Windows
Build script to create fully-static binaries of [**cURL**](https://curl.se/) for Windows.
These builds provide full Unicode support as well as support for TLS 1.3, HTTP/2, HTTP/3 (QUIC), SSH-2 and IDN.
Resulting binaries run on Windows XP (SP-3) or later. 64-Bit binaries require Windows XP x64 Edition.
![cURL](curl-screenshot.png)
## Prerequisites
This build script is based on [**MinGW-w64**](https://www.mingw-w64.org/) and [**MSYS2**](https://www.msys2.org/).
### Detailed install instructions:
1. Install the MSYS2 base-system using the installer (i.e. `msys2-x86_64-yyyymmdd.exe`) from the website:
<https://repo.msys2.org/distrib/x86_64/>
**Important:** If MSYS2 was installed to a directory other than `C:\msys64`, the variable `MSYS2_DIR` in `make.cmd` must be edited accordingly!
2. Once the MSYS2 base-system has been installed, updated all packages to the latest version:
```
$ pacman -Syyuu
```
**Note:** After the first update, close and re-open the MSYS2 terminal, then run the same command *again*!
3. Now install the 32-Bit *and* 64-Bit MinGW-w64 tool-chains:
```
$ pacman -S --noconfirm mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
```
(Be sure to **not** install the "UCRT" variants of these tool-chains, but the "traditional" MSVCRT-based ones!)
4. Finally install the "base" development tools, CMake *and* ZIP:
```
$ pacman -S --noconfirm --needed base-devel cmake zip
```
## Build instructions
In order to build the 32-Bit *and* 64-Bit cURL packages, just run **`make.cmd`** from the cURL Windows base directory!
Optionally, you can build *only* the 32-Bit or 64-Bit package:
1. Open either the *32-Bit* (`mingw32.exe`) or the *64-Bit* (`mingw64.exe`) MSYS2 terminal
2. Change the working directory to the cURL Windows base directory (i.e. where `build.sh` is located)
3. Now run the **`./build.sh`** script!
## Acknowledgement
cURL has been created by Daniel Stenberg, daniel@haxx.se, and many contributors.
For details, see:
https://curl.se/docs/copyright.html

355
build.sh
View File

@ -5,13 +5,56 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
set -e
trap 'read -p "Press any key..." x' EXIT
set -eo pipefail
trap 'read -p "Press any key..." x || true' EXIT
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set up compiler
# cURL version
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case "$(cc -dumpmachine)" in
readonly MY_VERSION=8.11.0
###############################################################################
# PREPARATION
###############################################################################
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check bash version
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ -z "${BASH}" ] || [ ${BASH_VERSINFO[0]} -lt 5 ]; then
echo 'This script requires BASH 5.x or newer !!!'
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check environment
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly UNAME_SPEC="$(uname -so)"
if [[ "${UNAME_SPEC,,}" =~ ^mingw(32|64)(.*)msys$ ]]; then
echo "Running on: ${UNAME_SPEC}"
else
echo 'This script is supposed to run on MSYS2/Mingw-w64 !!!'
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check C compiler
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly CC_TARGET="$(cc -dumpmachine)"
if [[ "${CC_TARGET,,}" =~ w64-mingw(32|64)$ ]]; then
echo "Target arch: ${CC_TARGET}"
else
if [[ -n "${CC_TARGET}" ]]; then
echo 'This script is supposed to run on MSYS2/Mingw-w64 !!!'
else
echo 'Sorry, no working C compiler found !!!'
fi
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set up the compiler flags
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case "${CC_TARGET}" in
i686-*)
readonly MY_CPU=x86
readonly MY_MARCH=i486
@ -23,93 +66,144 @@ case "$(cc -dumpmachine)" in
readonly MY_MTUNE=znver3
;;
*)
echo "Unknown compiler detected!";
echo "Unknown compiler arch detected !!!";
exit 1
;;
esac
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Initialize paths
# Base directory
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly BASE_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
readonly LIBS_DIR="${BASE_DIR}/.local/${MY_CPU}"
find "${BASE_DIR}" -maxdepth 1 -type d -name "*-${MY_CPU}" -exec rm -rf "{}" \;
rm -rf "${LIBS_DIR}" && mkdir -p "${LIBS_DIR}/.pkg" "${LIBS_DIR}/bin" "${LIBS_DIR}/include" "${LIBS_DIR}/lib/pkgconfig" "${LIBS_DIR}/share"
if [ ! -d "${BASE_DIR}/build" ]; then
echo 'Failed to find the "build" directory !!!';
exit 1
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Mutex
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly SIGNATURE="$(date +"%s")-$$"
readonly LOCK_FILE="${BASE_DIR}/build/lockfile.${MY_CPU}"
readonly TEMP_FILE="$(mktemp /tmp/lockfile_XXXXX)"
printf "%s" "${SIGNATURE}" > "${TEMP_FILE}"
mv -n "${TEMP_FILE}" "${LOCK_FILE}"; rm -f "${TEMP_FILE}"
if [ "$(sed '/^$/d' "${LOCK_FILE}" | head -n1)" != "${SIGNATURE}" ] ; then
echo 'Error: Build process is already in progress !!!'
exit 1
else
trap "{ rm -f \"${LOCK_FILE}\"; read -p \"Press any key...\" x; } || true" EXIT
fi
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Logfile
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exec &> >(tee "${BASE_DIR}/build/curl_build-${MY_CPU}.log")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Initialize paths
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readonly WORK_DIR="${BASE_DIR}/build/${MY_CPU}"
readonly PKGS_DIR="${WORK_DIR}/_pkgs"
readonly DEPS_DIR="${WORK_DIR}/_deps"
for i in {1..12}; do rm -rf "${WORK_DIR}" && break; done
mkdir -v "${WORK_DIR}"
mkdir -p "${PKGS_DIR}" "${DEPS_DIR}/bin" "${DEPS_DIR}/include" "${DEPS_DIR}/lib/pkgconfig" "${DEPS_DIR}/share"
###############################################################################
# DOWNLOAD SOURCES
###############################################################################
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Helper function
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function fetch_pkg () {
if ! wget -4 --tries=8 --retry-connrefused -O "${2}" "${3}"; then
return 1
fi
local checksum_computed="$(sha256sum -b "${2}" | head -n 1 | grep -Po '^[[:xdigit:]]+')"
if ! [[ "${checksum_computed,,}" == "${1,,}" || "${1}" =~ ^z{64} ]]; then
printf "Checksum mismatch detected!\n* Expected: %s\n* Computed: %s\n" "${1,,}" "${checksum_computed,,}"
return 1
fi
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Download
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wget -4 -O "${LIBS_DIR}/.pkg/zlib.tar.gz" https://zlib.net/zlib-1.2.12.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/zstd.tar.gz" https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/brotli.tar.gz" https://github.com/google/brotli/archive/v1.0.9/brotli-1.0.9.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/openssl.tar.gz" https://github.com/quictls/openssl/archive/refs/heads/OpenSSL_1_1_1q+quic.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/rtmpdump.tar.gz" http://git.ffmpeg.org/gitweb/rtmpdump.git/snapshot/f1b83c10d8beb43fcc70a6e88cf4325499f25857.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/libiconv.tar.gz" https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/gettext.tar.gz" https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/libssh2.tar.gz" https://www.libssh2.org/download/libssh2-1.10.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/nghttp2.tar.gz" https://github.com/nghttp2/nghttp2/releases/download/v1.48.0/nghttp2-1.48.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/nghttp3.tar.gz" https://github.com/ngtcp2/nghttp3/releases/download/v0.5.0/nghttp3-0.5.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/ngtcp2.tar.gz" https://github.com/ngtcp2/ngtcp2/releases/download/v0.6.0/ngtcp2-0.6.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/libidn2.tar.gz" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.2.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/libgsasl.tar.gz" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/curl.tar.gz" https://curl.se/download/curl-7.84.0.tar.gz
wget -4 -O "${LIBS_DIR}/.pkg/cacert.pem" https://curl.se/ca/cacert.pem
wget -4 -O "${LIBS_DIR}/.pkg/manpage.html" https://curl.se/docs/manpage.html
printf "\n==================== download ====================\n\n"
fetch_pkg "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23" "${PKGS_DIR}/zlib.tar.gz" https://zlib.net/zlib-1.3.1.tar.gz
fetch_pkg "8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1" "${PKGS_DIR}/zstd.tar.gz" https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz
fetch_pkg "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff" "${PKGS_DIR}/brotli.tar.gz" https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz
fetch_pkg "78d675d94c0ac3a8b44073f0c2b373d948c5afd12b25c9e245262f563307a566" "${PKGS_DIR}/openssl.tar.gz" https://github.com/quictls/openssl/archive/refs/tags/openssl-3.3.0-quic1.tar.gz
fetch_pkg "c68e05989a93c002e3ba8df3baef0021c17099aa2123a9c096a5cc8e029caf95" "${PKGS_DIR}/rtmpdump.tar.gz" https://distfiles.macports.org/rtmpdump/f1b83c10d8beb43fcc70a6e88cf4325499f25857.tar.gz
fetch_pkg "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313" "${PKGS_DIR}/libiconv.tar.gz" https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
fetch_pkg "ec1705b1e969b83a9f073144ec806151db88127f5e40fe5a94cb6c8fa48996a0" "${PKGS_DIR}/gettext.tar.gz" https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.5.tar.gz
fetch_pkg "d9ec76cbe34db98eec3539fe2c899d26b0c837cb3eb466a56b0f109cabf658f7" "${PKGS_DIR}/libssh2.tar.gz" https://www.libssh2.org/download/libssh2-1.11.1.tar.gz
fetch_pkg "20e73f3cf9db3f05988996ac8b3a99ed529f4565ca91a49eb0550498e10621e8" "${PKGS_DIR}/nghttp2.tar.gz" https://github.com/nghttp2/nghttp2/releases/download/v1.64.0/nghttp2-1.64.0.tar.gz
fetch_pkg "a1f92f113c10faca2014b004eb97be363674e23546eb72591c1ac3533f93cba0" "${PKGS_DIR}/nghttp3.tar.gz" https://github.com/ngtcp2/nghttp3/releases/download/v1.6.0/nghttp3-1.6.0.tar.gz
fetch_pkg "72b544d2509b8fb58c493f9d3d71fe93959f94bca48aa0c87ddd56bf61178cee" "${PKGS_DIR}/ngtcp2.tar.gz" https://github.com/ngtcp2/ngtcp2/releases/download/v1.8.1/ngtcp2-1.8.1.tar.gz
fetch_pkg "4c21a791b610b9519b9d0e12b8097bf2f359b12f8dd92647611a929e6bfd7d64" "${PKGS_DIR}/libidn2.tar.gz" https://ftp.gnu.org/gnu/libidn/libidn2-2.3.7.tar.gz
fetch_pkg "1dcc9ceae8b128f3c0b3f654decd0e1e891afc6ff81098f227ef260449dae208" "${PKGS_DIR}/libpsl.tar.gz" https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz
fetch_pkg "f1b553384dedbd87478449775546a358d6f5140c15cccc8fb574136fdc77329f" "${PKGS_DIR}/libgsasl.tar.gz" https://ftp.gnu.org/gnu/gsasl/libgsasl-1.10.0.tar.gz
fetch_pkg "264537d90e58d2b09dddc50944baf3c38e7089151c8986715e2aaeaaf2b8118f" "${PKGS_DIR}/curl.tar.gz" https://curl.se/download/curl-${MY_VERSION}.tar.gz
fetch_pkg "189d3cf6d103185fba06d76c1af915263c6d42225481a1759e853b33ac857540" "${PKGS_DIR}/cacert.pem" https://curl.se/ca/cacert-2024-09-24.pem
fetch_pkg "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" "${PKGS_DIR}/manpage.html" https://curl.se/docs/manpage.html
###############################################################################
# BUILD DEPENDENCIES
###############################################################################
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# zlib
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== zlib ====================\n\n"
readonly ZLIB_DIR="${BASE_DIR}/zlib-${MY_CPU}"
readonly ZLIB_DIR="${WORK_DIR}/zlib"
rm -rf "${ZLIB_DIR}" && mkdir "${ZLIB_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/zlib.tar.gz" --strip-components=1 -C "${ZLIB_DIR}"
tar -xvf "${PKGS_DIR}/zlib.tar.gz" --strip-components=1 -C "${ZLIB_DIR}"
pushd "${ZLIB_DIR}"
make -f win32/Makefile.gcc LOC="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501"
make -f win32/Makefile.gcc install BINARY_PATH="${LIBS_DIR}/include" INCLUDE_PATH="${LIBS_DIR}/include" LIBRARY_PATH="${LIBS_DIR}/lib"
make -f win32/Makefile.gcc install BINARY_PATH="${DEPS_DIR}/include" INCLUDE_PATH="${DEPS_DIR}/include" LIBRARY_PATH="${DEPS_DIR}/lib"
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Zstandard
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== Zstandard ====================\n\n"
readonly ZSTD_DIR="${BASE_DIR}/zstd-${MY_CPU}"
readonly ZSTD_DIR="${WORK_DIR}/zstd"
rm -rf "${ZSTD_DIR}" && mkdir "${ZSTD_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/zstd.tar.gz" --strip-components=1 -C "${ZSTD_DIR}"
tar -xvf "${PKGS_DIR}/zstd.tar.gz" --strip-components=1 -C "${ZSTD_DIR}" || true
pushd "${ZSTD_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" make lib
cp -vf lib/libzstd.a "${LIBS_DIR}/lib"
cp -vf lib/zstd.h lib/zstd_errors.h lib/zdict.h "${LIBS_DIR}/include"
sed -e "s|@PREFIX@|${LIBS_DIR}|g" -e 's|@EXEC_PREFIX@|${prefix}|g' -e 's|@INCLUDEDIR@|${prefix}/include|g' -e 's|@LIBDIR@|${prefix}/lib|g' -e 's|@VERSION@|1.5.0|g' lib/libzstd.pc.in > "${LIBS_DIR}/lib/pkgconfig/libzstd.pc"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" make lib V=1
cp -vf lib/libzstd.a "${DEPS_DIR}/lib"
cp -vf lib/zstd.h lib/zstd_errors.h lib/zdict.h "${DEPS_DIR}/include"
sed -e "s|@PREFIX@|${DEPS_DIR}|g" -e 's|@EXEC_PREFIX@|${prefix}|g' -e 's|@INCLUDEDIR@|${prefix}/include|g' -e 's|@LIBDIR@|${prefix}/lib|g' -e 's|@VERSION@|1.5.0|g' lib/libzstd.pc.in > "${DEPS_DIR}/lib/pkgconfig/libzstd.pc"
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Brotli
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== Brotli ====================\n\n"
readonly BROT_DIR="${BASE_DIR}/brotli-${MY_CPU}"
readonly BROT_DIR="${WORK_DIR}/brotli"
rm -rf "${BROT_DIR}" && mkdir "${BROT_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/brotli.tar.gz" --strip-components=1 -C "${BROT_DIR}"
pushd "${BROT_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" make lib
mkdir -p "${LIBS_DIR}/include/brotli"
cp -vf c/include/brotli/*.h "${LIBS_DIR}/include/brotli"
for fname in scripts/*.pc.in; do
cp -vf libbrotli.a "${LIBS_DIR}/lib/$(basename "${fname}" .pc.in).a"
sed -e "s|@prefix@|${LIBS_DIR}|g" -e 's|@exec_prefix@|${prefix}|g' -e 's|@includedir@|${prefix}/include|g' -e 's|@libdir@|${prefix}/lib|g' -e 's|@PACKAGE_VERSION@|1.0.9|g' ${fname} > "${LIBS_DIR}/lib/pkgconfig/$(basename "${fname}" .in)"
done
tar -xvf "${PKGS_DIR}/brotli.tar.gz" --strip-components=1 -C "${BROT_DIR}"
mkdir "${BROT_DIR}/out"
pushd "${BROT_DIR}/out"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib -static" cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="${DEPS_DIR}" ..
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib -static" cmake --build . --config Release --target install
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# OpenSSL
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== OpenSSL ====================\n\n"
readonly OSSL_DIR="${BASE_DIR}/openssl-${MY_CPU}"
readonly OSSL_DIR="${WORK_DIR}/openssl"
rm -rf "${OSSL_DIR}" && mkdir "${OSSL_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/openssl.tar.gz" --strip-components=1 -C "${OSSL_DIR}"
tar -xvf "${PKGS_DIR}/openssl.tar.gz" --strip-components=1 -C "${OSSL_DIR}"
[[ "${MY_CPU}" == "x64" ]] && readonly ossl_flag="no-sse2" || readonly ossl_flag="386"
[[ "${MY_CPU}" == "x64" ]] && readonly ossl_mngw="mingw64" || readonly ossl_mngw="mingw"
pushd "${OSSL_DIR}"
./Configure no-hw no-shared no-engine no-capieng no-dso zlib ${ossl_flag} -static -march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I"${LIBS_DIR}/include" -L"${LIBS_DIR}/lib" --prefix="${LIBS_DIR}" ${ossl_mngw}
./Configure no-hw no-shared no-engine no-capieng no-dso zlib ${ossl_flag} -static -march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I"${DEPS_DIR}/include" -L"${DEPS_DIR}/lib" --prefix="${DEPS_DIR}" --libdir="lib" ${ossl_mngw}
make build_libs && make install_dev
popd
@ -117,24 +211,24 @@ popd
# librtmp
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== librtmp ====================\n\n"
readonly RTMP_DIR="${BASE_DIR}/librtmp-${MY_CPU}"
readonly RTMP_DIR="${WORK_DIR}/librtmp"
rm -rf "${RTMP_DIR}" && mkdir "${RTMP_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/rtmpdump.tar.gz" --strip-components=1 -C "${RTMP_DIR}"
tar -xvf "${PKGS_DIR}/rtmpdump.tar.gz" --strip-components=1 -C "${RTMP_DIR}"
pushd "${RTMP_DIR}"
patch -p1 -b < "${BASE_DIR}/patch/librtmp_openssl.diff"
make SYS=mingw SHARED= prefix="${LIBS_DIR}" XCFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" XLDFLAGS="-L${LIBS_DIR}/lib" XLIBS="-lws2_32"
make SYS=mingw SHARED= prefix="${LIBS_DIR}" install
make SYS=mingw SHARED= prefix="${DEPS_DIR}" XCFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" XLDFLAGS="-L${DEPS_DIR}/lib" XLIBS="-lws2_32 -lcrypt32"
make SYS=mingw SHARED= prefix="${DEPS_DIR}" install
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libiconv
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libiconv ====================\n\n"
readonly ICNV_DIR="${BASE_DIR}/libiconv-${MY_CPU}"
readonly ICNV_DIR="${WORK_DIR}/libiconv"
rm -rf "${ICNV_DIR}" && mkdir "${ICNV_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/libiconv.tar.gz" --strip-components=1 -C "${ICNV_DIR}"
tar -xvf "${PKGS_DIR}/libiconv.tar.gz" --strip-components=1 -C "${ICNV_DIR}"
pushd "${ICNV_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-rpath --disable-shared
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-rpath --disable-shared
make && make install
popd
@ -142,11 +236,11 @@ popd
# gettext
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== gettext ====================\n\n"
readonly GTXT_DIR="${BASE_DIR}/gettext-${MY_CPU}"
readonly GTXT_DIR="${WORK_DIR}/gettext"
rm -rf "${GTXT_DIR}" && mkdir "${GTXT_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/gettext.tar.gz" --strip-components=1 -C "${GTXT_DIR}"
tar -xvf "${PKGS_DIR}/gettext.tar.gz" --strip-components=1 -C "${GTXT_DIR}"
pushd "${GTXT_DIR}/gettext-runtime"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-shared --disable-libasprintf --without-emacs --disable-java --disable-native-java --disable-csharp --disable-openmp
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared --disable-libasprintf --without-emacs --disable-java --disable-native-java --disable-csharp --disable-openmp
make && make install
popd
@ -154,12 +248,12 @@ popd
# libssh2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libssh2 ====================\n\n"
readonly SSH2_DIR="${BASE_DIR}/libssh2-${MY_CPU}"
readonly SSH2_DIR="${WORK_DIR}/libssh2"
rm -rf "${SSH2_DIR}" && mkdir "${SSH2_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/libssh2.tar.gz" --strip-components=1 -C "${SSH2_DIR}"
tar -xvf "${PKGS_DIR}/libssh2.tar.gz" --strip-components=1 -C "${SSH2_DIR}"
pushd "${SSH2_DIR}"
patch -p1 -b < "${BASE_DIR}/patch/ssh2_session.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-examples-build --disable-shared --with-libz
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-examples-build --disable-shared --with-libz
make && make install
popd
@ -167,11 +261,12 @@ popd
# nghttp2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== nghttp2 ====================\n\n"
readonly NGH2_DIR="${BASE_DIR}/nghttp2-${MY_CPU}"
readonly NGH2_DIR="${WORK_DIR}/nghttp2"
rm -rf "${NGH2_DIR}" && mkdir "${NGH2_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/nghttp2.tar.gz" --strip-components=1 -C "${NGH2_DIR}"
tar -xvf "${PKGS_DIR}/nghttp2.tar.gz" --strip-components=1 -C "${NGH2_DIR}"
pushd "${NGH2_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" OPENSSL_CFLAGS="-I${LIBS_DIR}/include" OPENSSL_LIBS="-L${LIBS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${LIBS_DIR}/include" ZLIB_LIBS="-L${LIBS_DIR}/lib -lz" ./configure --prefix="${LIBS_DIR}" --enable-lib-only --disable-threads --disable-shared
patch -p1 -b < "${BASE_DIR}/patch/nghttp2_time.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" OPENSSL_CFLAGS="-I${DEPS_DIR}/include" OPENSSL_LIBS="-L${DEPS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${DEPS_DIR}/include" ZLIB_LIBS="-L${DEPS_DIR}/lib -lz" ./configure --prefix="${DEPS_DIR}" --enable-lib-only --disable-threads --disable-shared
make && make install
popd
@ -179,11 +274,11 @@ popd
# nghttp3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== nghttp3 ====================\n\n"
readonly NGH3_DIR="${BASE_DIR}/nghttp3-${MY_CPU}"
readonly NGH3_DIR="${WORK_DIR}/nghttp3"
rm -rf "${NGH3_DIR}" && mkdir "${NGH3_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/nghttp3.tar.gz" --strip-components=1 -C "${NGH3_DIR}"
tar -xvf "${PKGS_DIR}/nghttp3.tar.gz" --strip-components=1 -C "${NGH3_DIR}"
pushd "${NGH3_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" OPENSSL_CFLAGS="-I${LIBS_DIR}/include" OPENSSL_LIBS="-L${LIBS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${LIBS_DIR}/include" ZLIB_LIBS="-L${LIBS_DIR}/lib -lz" ./configure --prefix="${LIBS_DIR}" --enable-lib-only --disable-threads --disable-shared
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" OPENSSL_CFLAGS="-I${DEPS_DIR}/include" OPENSSL_LIBS="-L${DEPS_DIR}/lib -lssl -lcrypto" ZLIB_CFLAGS="-I${DEPS_DIR}/include" ZLIB_LIBS="-L${DEPS_DIR}/lib -lz" ./configure --prefix="${DEPS_DIR}" --enable-lib-only --disable-threads --disable-shared
make && make install
popd
@ -191,12 +286,11 @@ popd
# ngtcp2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== ngtcp2 ====================\n\n"
readonly TCP2_DIR="${BASE_DIR}/ngtcp2-${MY_CPU}"
readonly TCP2_DIR="${WORK_DIR}/ngtcp2"
rm -rf "${TCP2_DIR}" && mkdir "${TCP2_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/ngtcp2.tar.gz" --strip-components=1 -C "${TCP2_DIR}"
tar -xvf "${PKGS_DIR}/ngtcp2.tar.gz" --strip-components=1 -C "${TCP2_DIR}"
pushd "${TCP2_DIR}"
patch -p1 -b < "${BASE_DIR}/patch/ngtcp2_htons.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" OPENSSL_CFLAGS="-I${LIBS_DIR}/include" OPENSSL_LIBS="-L${LIBS_DIR}/lib -lssl -lcrypto -lws2_32 -lz" ZLIB_CFLAGS="-I${LIBS_DIR}/include" ZLIB_LIBS="-L${LIBS_DIR}/lib -lz" ./configure --prefix="${LIBS_DIR}" --enable-lib-only --with-openssl --disable-shared
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" OPENSSL_CFLAGS="-I${DEPS_DIR}/include" OPENSSL_LIBS="-L${DEPS_DIR}/lib -lssl -lcrypto -lws2_32 -lz -lcrypt32" ZLIB_CFLAGS="-I${DEPS_DIR}/include" ZLIB_LIBS="-L${DEPS_DIR}/lib -lz" ./configure --prefix="${DEPS_DIR}" --enable-lib-only --with-openssl --disable-shared
make && make install
popd
@ -204,11 +298,23 @@ popd
# libidn2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libidn2 ====================\n\n"
readonly IDN2_DIR="${BASE_DIR}/libidn2-${MY_CPU}"
readonly IDN2_DIR="${WORK_DIR}/libidn2"
rm -rf "${IDN2_DIR}" && mkdir "${IDN2_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/libidn2.tar.gz" --strip-components=1 -C "${IDN2_DIR}"
tar -xvf "${PKGS_DIR}/libidn2.tar.gz" --strip-components=1 -C "${IDN2_DIR}"
pushd "${IDN2_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-shared --disable-doc --without-libiconv-prefix --without-libunistring-prefix --disable-valgrind-tests
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared --disable-doc --without-libiconv-prefix --without-libunistring-prefix --disable-valgrind-tests
make && make install
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# libpsl
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libpsl ====================\n\n"
readonly LPSL_DIR="${WORK_DIR}/libpsl"
rm -rf "${LPSL_DIR}" && mkdir "${LPSL_DIR}"
tar -xvf "${PKGS_DIR}/libpsl.tar.gz" --strip-components=1 -C "${LPSL_DIR}"
pushd "${LPSL_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared
make && make install
popd
@ -216,11 +322,11 @@ popd
# libgsasl
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== libgsasl ====================\n\n"
readonly SASL_DIR="${BASE_DIR}/libgsasl-${MY_CPU}"
readonly SASL_DIR="${WORK_DIR}/libgsasl"
rm -rf "${SASL_DIR}" && mkdir "${SASL_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/libgsasl.tar.gz" --strip-components=1 -C "${SASL_DIR}"
tar -xvf "${PKGS_DIR}/libgsasl.tar.gz" --strip-components=1 -C "${SASL_DIR}"
pushd "${SASL_DIR}"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" ./configure --prefix="${LIBS_DIR}" --disable-shared --disable-valgrind-tests --disable-obsolete -without-libintl-prefix
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${DEPS_DIR}/include -Wno-error=int-conversion" LDFLAGS="-L${DEPS_DIR}/lib" ./configure --prefix="${DEPS_DIR}" --disable-shared --disable-valgrind-tests --disable-obsolete -without-libintl-prefix
make && make install
popd
@ -228,72 +334,83 @@ popd
# cURL
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== cURL ====================\n\n"
readonly CURL_DIR="${BASE_DIR}/curl-${MY_CPU}"
readonly CURL_DIR="${WORK_DIR}/curl"
rm -rf "${CURL_DIR}" && mkdir "${CURL_DIR}"
tar -xvf "${LIBS_DIR}/.pkg/curl.tar.gz" --strip-components=1 -C "${CURL_DIR}"
tar -xvf "${PKGS_DIR}/curl.tar.gz" --strip-components=1 -C "${CURL_DIR}"
pushd "${CURL_DIR}"
sed -i -E 's/\bmain[[:space:]]*\(([^\(\)]*)\)/wmain(\1)/g' configure
patch -p1 -b < "${BASE_DIR}/patch/curl_getenv.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_threads.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_doswin.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_getparam.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_operate.diff"
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_parsecfg.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${LIBS_DIR}/include" CPPFLAGS="-DNDEBUG -D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DNGHTTP3_STATICLIB -DNGTCP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-municode -mconsole -Wl,--trace -static -no-pthread -L${LIBS_DIR}/lib" LIBS="-liconv -lcrypt32 -lwinmm" PKG_CONFIG_PATH="${LIBS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib --with-zstd --with-brotli --with-openssl --with-librtmp --with-libssh2 --with-nghttp2="${LIBS_DIR}" --with-ngtcp2="${LIBS_DIR}" --with-nghttp3="${LIBS_DIR}" --with-libidn2 --with-gsasl --without-ca-bundle
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_util.diff"
CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -I${DEPS_DIR}/include" CPPFLAGS="-DNDEBUG -D_WIN32_WINNT=0x0501 -DNGHTTP2_STATICLIB -DNGHTTP3_STATICLIB -DNGTCP2_STATICLIB -DUNICODE -D_UNICODE" LDFLAGS="-mconsole -Wl,--trace -static -no-pthread -L${DEPS_DIR}/lib" LIBS="-liconv -lcrypt32 -lwinmm -lbrotlicommon" PKG_CONFIG_PATH="${DEPS_DIR}/lib/pkgconfig" ./configure --enable-static --disable-shared --enable-windows-unicode --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --enable-ca-search-safe --with-zlib --with-zstd --with-brotli --with-openssl --with-librtmp --with-libssh2 --with-nghttp2="${DEPS_DIR}" --with-ngtcp2="${DEPS_DIR}" --with-nghttp3="${DEPS_DIR}" --with-libidn2 --without-ca-bundle
make V=1
strip -s src/curl.exe
popd
###############################################################################
# CREATE RELEASE FILES
###############################################################################
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Output
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\n==================== Output ====================\n\n"
readonly OUT_DIR="${BASE_DIR}/.bin/${MY_CPU}"
readonly OUT_DIR="${WORK_DIR}/_bin"
rm -rf "${OUT_DIR}" && mkdir -p "${OUT_DIR}"
pushd "${OUT_DIR}"
cp -vf "${CURL_DIR}/src/curl.exe" curl.exe
cp -vf "${LIBS_DIR}/.pkg/cacert.pem" curl-ca-bundle.crt
cp -vf "${LIBS_DIR}/.pkg/manpage.html" manpage.html
cp -vf "${CURL_DIR}/src/curl.exe" curl.exe
cp -vf "${PKGS_DIR}/cacert.pem" curl-ca-bundle.crt
cp -vf "${PKGS_DIR}/manpage.html" manpage.html
sed -n "/Configured to build curl\/libcurl:$/,/^[[:space:]]*Features:/p" "${CURL_DIR}/config.log" | sed -r "s/configure:[[:digit:]]+://" | sed -r "s/^[[:blank:]]*//" | unix2dos > config.log
mkdir -p "${OUT_DIR}/legal"
unix2dos -n "${BROT_DIR}/LICENSE" legal/brotli.LICENSE.txt
unix2dos -n "${BROT_DIR}/README.md" legal/brotli.README.md
unix2dos -n "${CURL_DIR}/CHANGES" legal/curl.CHANGES.txt
unix2dos -n "${CURL_DIR}/COPYING" legal/curl.COPYING.txt
unix2dos -n "${CURL_DIR}/README" legal/curl.README.txt
unix2dos -n "${GTXT_DIR}/AUTHORS" legal/gettext.AUTHORS.txt
unix2dos -n "${GTXT_DIR}/COPYING" legal/gettext.COPYING.txt
unix2dos -n "${GTXT_DIR}/README" legal/gettext.README.txt
unix2dos -n "${ICNV_DIR}/AUTHORS" legal/libiconv.AUTHORS.txt
unix2dos -n "${ICNV_DIR}/COPYING" legal/libiconv.COPYING.txt
unix2dos -n "${ICNV_DIR}/README" legal/libiconv.README
unix2dos -n "${IDN2_DIR}/AUTHORS" legal/libidn2.AUTHORS.txt
unix2dos -n "${IDN2_DIR}/COPYING" legal/libidn2.COPYING.txt
unix2dos -n "${IDN2_DIR}/README.md" legal/libidn2.README.md
unix2dos -n "${NGH2_DIR}/AUTHORS" legal/nghttp2.AUTHORS.txt
unix2dos -n "${NGH2_DIR}/COPYING" legal/nghttp2.COPYING.txt
unix2dos -n "${NGH2_DIR}/README.rst" legal/nghttp2.README.rst
unix2dos -n "${NGH3_DIR}/COPYING" legal/nghttp3.COPYING.txt
unix2dos -n "${NGH3_DIR}/README.rst" legal/nghttp3.README.rst
unix2dos -n "${TCP2_DIR}/COPYING" legal/ngtcp2.COPYING.txt
unix2dos -n "${TCP2_DIR}/README.rst" legal/ngtcp2.README.rst
unix2dos -n "${OSSL_DIR}/AUTHORS" legal/openssl.AUTHORS.txt
unix2dos -n "${OSSL_DIR}/LICENSE" legal/openssl.LICENSE.txt
unix2dos -n "${OSSL_DIR}/README.md" legal/openssl.README.md
unix2dos -n "${RTMP_DIR}/COPYING" legal/librtmp.COPYING.txt
unix2dos -n "${RTMP_DIR}/README" legal/librtmp.README.txt
unix2dos -n "${SASL_DIR}/AUTHORS" legal/libgsasl.AUTHORS.txt
unix2dos -n "${SASL_DIR}/COPYING" legal/libgsasl.COPYING.txt
unix2dos -n "${SASL_DIR}/README" legal/libgsasl.README.txt
unix2dos -n "${SSH2_DIR}/COPYING" legal/libssh2.COPYING.txt
unix2dos -n "${SSH2_DIR}/README" legal/libssh2.README.txt
unix2dos -n "${ZLIB_DIR}/README" legal/zlib.README.txt
unix2dos -n "${ZSTD_DIR}/LICENSE" legal/zstandard.LICENSE.txt
unix2dos -n "${ZSTD_DIR}/README.md" legal/zstandard.README.md
unix2dos -n "${BROT_DIR}/LICENSE" "legal/brotli.LICENSE.txt"
unix2dos -n "${BROT_DIR}/README.md" "legal/brotli.README.md"
unix2dos -n "${CURL_DIR}/CHANGES.md" "legal/curl.CHANGES.txt"
unix2dos -n "${CURL_DIR}/COPYING" "legal/curl.COPYING.txt"
unix2dos -n "${CURL_DIR}/README" "legal/curl.README.txt"
unix2dos -n "${GTXT_DIR}/AUTHORS" "legal/gettext.AUTHORS.txt"
unix2dos -n "${GTXT_DIR}/COPYING" "legal/gettext.COPYING.txt"
unix2dos -n "${GTXT_DIR}/README" "legal/gettext.README.txt"
unix2dos -n "${ICNV_DIR}/AUTHORS" "legal/libiconv.AUTHORS.txt"
unix2dos -n "${ICNV_DIR}/COPYING" "legal/libiconv.COPYING.txt"
unix2dos -n "${ICNV_DIR}/README" "legal/libiconv.README"
unix2dos -n "${IDN2_DIR}/AUTHORS" "legal/libidn2.AUTHORS.txt"
unix2dos -n "${IDN2_DIR}/COPYING" "legal/libidn2.COPYING.txt"
unix2dos -n "${IDN2_DIR}/README.md" "legal/libidn2.README.md"
unix2dos -n "${LPSL_DIR}/AUTHORS" "legal/libpsl.AUTHORS.txt"
unix2dos -n "${LPSL_DIR}/COPYING" "legal/libpsl.COPYING.txt"
unix2dos -n "${NGH2_DIR}/AUTHORS" "legal/nghttp2.AUTHORS.txt"
unix2dos -n "${NGH2_DIR}/COPYING" "legal/nghttp2.COPYING.txt"
unix2dos -n "${NGH2_DIR}/README.rst" "legal/nghttp2.README.rst"
unix2dos -n "${NGH3_DIR}/COPYING" "legal/nghttp3.COPYING.txt"
unix2dos -n "${NGH3_DIR}/README.rst" "legal/nghttp3.README.rst"
unix2dos -n "${TCP2_DIR}/COPYING" "legal/ngtcp2.COPYING.txt"
unix2dos -n "${TCP2_DIR}/README.rst" "legal/ngtcp2.README.rst"
unix2dos -n "${OSSL_DIR}/AUTHORS.md" "legal/openssl.AUTHORS.md"
unix2dos -n "${OSSL_DIR}/LICENSE.txt" "legal/openssl.LICENSE.txt"
unix2dos -n "${OSSL_DIR}/README.md" "legal/openssl.README.md"
unix2dos -n "${RTMP_DIR}/COPYING" "legal/librtmp.COPYING.txt"
unix2dos -n "${RTMP_DIR}/README" "legal/librtmp.README.txt"
unix2dos -n "${SASL_DIR}/AUTHORS" "legal/libgsasl.AUTHORS.txt"
unix2dos -n "${SASL_DIR}/COPYING" "legal/libgsasl.COPYING.txt"
unix2dos -n "${SASL_DIR}/README" "legal/libgsasl.README.txt"
unix2dos -n "${SSH2_DIR}/COPYING" "legal/libssh2.COPYING.txt"
unix2dos -n "${SSH2_DIR}/README" "legal/libssh2.README.txt"
unix2dos -n "${ZLIB_DIR}/README" "legal/zlib.README.txt"
unix2dos -n "${ZSTD_DIR}/LICENSE" "legal/zstandard.LICENSE.txt"
unix2dos -n "${ZSTD_DIR}/README.md" "legal/zstandard.README.md"
mkdir -p "${OUT_DIR}/patch"
cp -vf "${BASE_DIR}/patch/"*.diff "${OUT_DIR}/patch"
find "${OUT_DIR}" -type f -exec chmod 444 "{}" \;
readonly zfile="${BASE_DIR}/curl-windows-${MY_CPU}.$(date +"%Y-%m-%d").zip"
readonly zfile="${BASE_DIR}/build/curl-${MY_VERSION}-windows-${MY_CPU}.$(date +"%Y-%m-%d").zip"
rm -rf "${zfile}" && zip -v -r -9 "${zfile}" "."
chmod 444 "${zfile}"
popd
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Complete
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf "\nCompleted.\n\n"

1
build/.gitkeep Normal file
View File

@ -0,0 +1 @@
keep directory!

BIN
curl-screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View File

@ -6,7 +6,7 @@ set "MSYS2_DIR=C:\msys64"
echo "%MSYS2_DIR%\msys2_shell.cmd" -mingw32 -where "%~dp0" -c "./build.sh"
call "%MSYS2_DIR%\msys2_shell.cmd" -mingw32 -where "%~dp0" -c "./build.sh"
TIMEOUT /T 10 /NOBREAK > NUL
TIMEOUT /T 5 /NOBREAK > NUL
echo "%MSYS2_DIR%\msys2_shell.cmd" -mingw64 -where "%~dp0" -c "./build.sh"
call "%MSYS2_DIR%\msys2_shell.cmd" -mingw64 -where "%~dp0" -c "./build.sh"

View File

@ -1,11 +1,11 @@
lib/getenv.c | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
lib/getenv.c | 47 ++++++++++++++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/lib/getenv.c b/lib/getenv.c
index 5f00fd1..3eff07a 100644
index 49a2e50..dbf2642 100644
--- a/lib/getenv.c
+++ b/lib/getenv.c
@@ -26,25 +26,23 @@
@@ -26,26 +26,23 @@
#include <curl/curl.h>
#include "curl_memory.h"
@ -14,35 +14,36 @@ index 5f00fd1..3eff07a 100644
#include "memdebug.h"
-static char *GetEnv(const char *variable)
+#ifdef WIN32
+static TCHAR *GetEnv(const TCHAR *variable)
+#if defined(_WIN32)
+static wchar_t *GetEnv(const wchar_t *variable)
{
-#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
-#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_UWP) || \
- defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */
- (void)variable;
- return NULL;
-#elif defined(WIN32)
-#elif defined(_WIN32)
/* This uses Windows API instead of C runtime getenv() to get the environment
variable since some changes aren't always visible to the latter. #4774 */
variable since some changes are not always visible to the latter. #4774 */
- char *buf = NULL;
- char *tmp;
+ TCHAR *buf = NULL;
+ TCHAR *tmp;
+ wchar_t *buf = NULL;
+ wchar_t *tmp;
DWORD bufsize;
DWORD rc = 1;
const DWORD max = 32768; /* max env var size from MSCRT source */
for(;;) {
- tmp = realloc(buf, rc);
+ tmp = (TCHAR*)realloc(buf, rc * sizeof(TCHAR));
+ tmp = (wchar_t*)realloc(buf, rc * sizeof(wchar_t));
if(!tmp) {
free(buf);
return NULL;
@@ -55,25 +53,44 @@ static char *GetEnv(const char *variable)
@@ -56,25 +53,41 @@ static char *GetEnv(const char *variable)
/* It's possible for rc to be 0 if the variable was found but empty.
Since getenv doesn't make that distinction we ignore it as well. */
/* it is possible for rc to be 0 if the variable was found but empty.
Since getenv does not make that distinction we ignore it as well. */
- rc = GetEnvironmentVariableA(variable, buf, bufsize);
+ rc = GetEnvironmentVariable(variable, buf, bufsize);
+ rc = GetEnvironmentVariableW(variable, buf, bufsize);
if(!rc || rc == bufsize || rc > max) {
free(buf);
return NULL;
@ -61,11 +62,11 @@ index 5f00fd1..3eff07a 100644
+
+char *curl_getenv(const char *variable)
+{
+#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_APP)
+#if defined(_WIN32_WCE) || defined(CURL_WINDOWS_UWP) || \
+ defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */
+ (void)variable;
+ return NULL;
+#elif defined(WIN32)
+#ifdef UNICODE
+#elif defined(_WIN32)
+ char *value = NULL;
+ wchar_t *variable_w = curlx_convert_UTF8_to_wchar(variable);
+ if(variable_w) {
@ -77,12 +78,9 @@ index 5f00fd1..3eff07a 100644
+ free(variable_w);
+ }
+ return value;
+#else
+ return GetEnv(variable);
+#endif
#else
char *env = getenv(variable);
return (env && env[0])?strdup(env):NULL;
return (env && env[0]) ? strdup(env) : NULL;
#endif
}
-

View File

@ -1,17 +1,13 @@
lib/curl_threads.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/curl_threads.h b/lib/curl_threads.h
index 63392f6..8a40108 100644
--- a/lib/curl_threads.h
+++ b/lib/curl_threads.h
@@ -39,13 +39,7 @@
diff --git "a/lib/curl_threads.h" "b/lib/curl_threads.h"
index 27a478d..a8fd9cb 100644
--- "a/lib/curl_threads.h"
+++ "b/lib/curl_threads.h"
@@ -39,12 +39,7 @@
# define curl_mutex_t CRITICAL_SECTION
# define curl_thread_t HANDLE
# define curl_thread_t_null (HANDLE)0
-# if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
- (_WIN32_WINNT < _WIN32_WINNT_VISTA) || \
- (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
- (_WIN32_WINNT < _WIN32_WINNT_VISTA)
-# define Curl_mutex_init(m) InitializeCriticalSection(m)
-# else
-# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)

View File

@ -1,70 +1,29 @@
src/tool_doswin.c | 49 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 34 insertions(+), 15 deletions(-)
src/tool_doswin.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/tool_doswin.c b/src/tool_doswin.c
index d8695e9..27dc9b6 100644
index 70b263113..28489a521 100644
--- a/src/tool_doswin.c
+++ b/src/tool_doswin.c
@@ -614,6 +614,37 @@ char **__crt0_glob_function(char *arg)
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
*/
@@ -739,6 +739,8 @@ bool tool_isVistaOrGreater;
+static BOOL check_file_exists(const TCHAR *filename)
+{
+ const DWORD attr = GetFileAttributes(filename);
+ return (attr != INVALID_FILE_ATTRIBUTES) && (!(attr & FILE_ATTRIBUTE_DIRECTORY));
+}
CURLcode win32_init(void)
{
+ size_t acmdln_len, wcmdln_len;
+
+static char *execpath(const TCHAR *filename)
+{
+ static const size_t BUFFSIZE = 512;
+ TCHAR filebuffer[BUFFSIZE];
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
+ if((len > 0) && (len < BUFFSIZE)) {
+ TCHAR *lastdirchar = _tcsrchr(filebuffer, TEXT('\\'));
+ if(lastdirchar) {
+ *lastdirchar = TEXT('\0');
+ }
+ if (_tcslen(filebuffer) + _tcslen(filename) + 2U < BUFFSIZE) {
+ _tcscat(filebuffer, TEXT("\\"));
+ _tcscat(filebuffer, filename);
+ if (check_file_exists(filebuffer)) {
+#ifdef UNICODE
+ return curlx_convert_wchar_to_UTF8(filebuffer);
+#else
+ return strdup(filebuffer);
+#endif
+ }
+ }
+ }
+ return NULL;
+}
/* curlx_verify_windows_version must be called during init at least once
because it has its own initialization routine. */
if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT,
@@ -753,6 +755,12 @@ CURLcode win32_init(void)
init_terminal();
#endif
+ SecureZeroMemory(_acmdln, acmdln_len = strlen(_acmdln) * sizeof(char));
+ SecureZeroMemory(_wcmdln, wcmdln_len = wcslen(_wcmdln) * sizeof(wchar_t));
+
CURLcode FindWin32CACert(struct OperationConfig *config,
curl_sslbackend backend,
const TCHAR *bundle_file)
@@ -629,21 +660,9 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
if((curlinfo->features & CURL_VERSION_SSL) &&
backend != CURLSSLBACKEND_SCHANNEL) {
- DWORD res_len;
- TCHAR buf[PATH_MAX];
- TCHAR *ptr = NULL;
-
- buf[0] = TEXT('\0');
-
- res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
- if(res_len > 0) {
- char *mstr = curlx_convert_tchar_to_UTF8(buf);
- Curl_safefree(config->cacert);
- if(mstr)
- config->cacert = strdup(mstr);
- curlx_unicodefree(mstr);
- if(!config->cacert)
- result = CURLE_OUT_OF_MEMORY;
+ char *cacert = execpath(bundle_file);
+ if (cacert) {
+ config->cacert = cacert;
}
}
+ if (acmdln_len >= 4) strcpy(_acmdln, "curl");
+ if (wcmdln_len >= 4) wcscpy(_wcmdln, L"curl");
+
return CURLE_OK;
}

View File

@ -0,0 +1,29 @@
diff --git "a/src/tool_getparam.c" "b/src/tool_getparam.c"
index 1231b3bd6..434e9ddd3 100644
--- "a/src/tool_getparam.c"
+++ "b/src/tool_getparam.c"
@@ -23,6 +23,10 @@
***************************************************************************/
#include "tool_setup.h"
+#ifndef HAVE_WRITABLE_ARGV
+#define HAVE_WRITABLE_ARGV 1
+#endif
+
#include "strcase.h"
#include "curlx.h"
@@ -554,8 +558,13 @@ static void cleanarg(argv_item_t str)
* argument out so that the username:password is not displayed in the
* system process list */
if(str) {
+#ifdef _UNICODE
+ size_t len = wcslen(str);
+ wmemset(str, L' ', len);
+#else
size_t len = strlen(str);
memset(str, ' ', len);
+#endif
}
}
#else

View File

@ -0,0 +1,25 @@
src/tool_operate.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/tool_operate.c b/src/tool_operate.c
index a1212c9dd..d88fa3242 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -3007,11 +3007,15 @@ static CURLcode cacertpaths(struct OperationConfig *config)
#ifdef _WIN32
if(!env) {
#if defined(CURL_CA_SEARCH_SAFE)
- char *cacert = NULL;
- FILE *cafile = Curl_execpath("curl-ca-bundle.crt", &cacert);
+ TCHAR *cacert = NULL;
+ FILE *cafile = Curl_execpath(TEXT("curl-ca-bundle.crt"), &cacert);
if(cafile) {
fclose(cafile);
+#ifdef UNICODE
+ config->cacert = curlx_convert_wchar_to_UTF8(cacert);
+#else
config->cacert = strdup(cacert);
+#endif
}
#elif !defined(CURL_WINDOWS_UWP) && !defined(CURL_DISABLE_CA_SEARCH)
result = FindWin32CACert(config, TEXT("curl-ca-bundle.crt"));

View File

@ -1,53 +1,11 @@
src/tool_parsecfg.c | 42 ++++++++++++++++--------------------------
1 file changed, 16 insertions(+), 26 deletions(-)
src/tool_parsecfg.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index a166757..6a00b80 100644
index d79e869f0..93eb2a428 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -47,29 +47,20 @@ static const char *unslashquote(const char *line, char *param);
static bool my_get_line(FILE *fp, struct curlx_dynbuf *, bool *error);
#ifdef WIN32
-static FILE *execpath(const char *filename, char **pathp)
+static FILE *execpath(const TCHAR *filename)
{
- static char filebuffer[512];
- /* Get the filename of our executable. GetModuleFileName is already declared
- * via inclusions done in setup header file. We assume that we are using
- * the ASCII version here.
- */
- unsigned long len = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
- if(len > 0 && len < sizeof(filebuffer)) {
- /* We got a valid filename - get the directory part */
- char *lastdirchar = strrchr(filebuffer, '\\');
+ static const size_t BUFFSIZE = 512;
+ TCHAR filebuffer[BUFFSIZE];
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
+ if((len > 0) && (len < BUFFSIZE)) {
+ TCHAR *lastdirchar = _tcsrchr(filebuffer, TEXT('\\'));
if(lastdirchar) {
- size_t remaining;
- *lastdirchar = 0;
- /* If we have enough space, build the RC filename */
- remaining = sizeof(filebuffer) - strlen(filebuffer);
- if(strlen(filename) < remaining - 1) {
- FILE *f;
- msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
- *pathp = filebuffer;
- f = fopen(filebuffer, FOPEN_READTEXT);
- return f;
- }
+ *lastdirchar = TEXT('\0');
+ }
+ if (_tcslen(filebuffer) + _tcslen(filename) + 2U < BUFFSIZE) {
+ _tcscat(filebuffer, TEXT("\\"));
+ _tcscat(filebuffer, filename);
+ return _tfopen(filebuffer, TEXT(FOPEN_READTEXT));
}
}
@@ -89,7 +80,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
@@ -57,7 +57,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
if(!filename) {
/* NULL means load .curlrc from homedir! */
@ -56,21 +14,26 @@ index a166757..6a00b80 100644
if(curlrc) {
file = fopen(curlrc, FOPEN_READTEXT);
if(!file) {
@@ -100,14 +91,13 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
@@ -68,14 +68,16 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
}
#ifdef WIN32 /* Windows */
#ifdef _WIN32 /* Windows */
else {
- char *fullp;
+ TCHAR *fullp;
/* check for .curlrc then _curlrc in the dir of the executable */
- file = execpath(".curlrc", &fullp);
+ file = execpath(TEXT(".curlrc") /*,&fullp*/);
if(!file)
- file = execpath("_curlrc", &fullp);
+ file = execpath(TEXT("_curlrc") /*,&fullp*/);
- file = Curl_execpath(".curlrc", &fullp);
- if(!file)
- file = Curl_execpath("_curlrc", &fullp);
+ file = Curl_execpath(TEXT(".curlrc"), &fullp);
if(file)
/* this is the filename we read from */
- /* this is the filename we read from */
- filename = fullp;
+ filename = ".curlrc";
+ else {
+ file = Curl_execpath(TEXT("_curlrc"), &fullp);
+ if(file)
+ filename = "_curlrc";
+ }
}
#endif
}

63
patch/curl_tool_util.diff Normal file
View File

@ -0,0 +1,63 @@
src/tool_util.c | 33 +++++++++++++--------------------
src/tool_util.h | 2 +-
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/src/tool_util.c b/src/tool_util.c
index e657dacf0..7044ca008 100644
--- a/src/tool_util.c
+++ b/src/tool_util.c
@@ -191,28 +191,21 @@ int tool_ftruncate64(int fd, curl_off_t where)
#endif /* USE_TOOL_FTRUNCATE */
#ifdef _WIN32
-FILE *Curl_execpath(const char *filename, char **pathp)
+#define BUFFSIZE 512U
+FILE *Curl_execpath(const TCHAR *filename, TCHAR **pathp)
{
- static char filebuffer[512];
- unsigned long len;
- /* Get the filename of our executable. GetModuleFileName is already declared
- * via inclusions done in setup header file. We assume that we are using
- * the ASCII version here.
- */
- len = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
- if(len > 0 && len < sizeof(filebuffer)) {
- /* We got a valid filename - get the directory part */
- char *lastdirchar = strrchr(filebuffer, DIR_CHAR[0]);
+ static TCHAR filebuffer[BUFFSIZE];
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
+ if((len > 0) && (len < BUFFSIZE)) {
+ TCHAR *lastdirchar = _tcsrchr(filebuffer, TEXT('\\'));
if(lastdirchar) {
- size_t remaining;
- *lastdirchar = 0;
- /* If we have enough space, build the RC filename */
- remaining = sizeof(filebuffer) - strlen(filebuffer);
- if(strlen(filename) < remaining - 1) {
- msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
- *pathp = filebuffer;
- return fopen(filebuffer, FOPEN_READTEXT);
- }
+ *lastdirchar = TEXT('\0');
+ }
+ if (_tcslen(filebuffer) + _tcslen(filename) + 2U < BUFFSIZE) {
+ _tcscat(filebuffer, TEXT("\\"));
+ _tcscat(filebuffer, filename);
+ *pathp = filebuffer;
+ return _tfopen(filebuffer, TEXT(FOPEN_READTEXT));
}
}
diff --git a/src/tool_util.h b/src/tool_util.h
index 9fec7e873..93d7ef9fc 100644
--- a/src/tool_util.h
+++ b/src/tool_util.h
@@ -40,7 +40,7 @@ int struplocompare(const char *p1, const char *p2);
int struplocompare4sort(const void *p1, const void *p2);
#ifdef _WIN32
-FILE *Curl_execpath(const char *filename, char **pathp);
+FILE *Curl_execpath(const TCHAR *filename, TCHAR **pathp);
#endif
#endif /* HEADER_CURL_TOOL_UTIL_H */

52
patch/nghttp2_time.diff Normal file
View File

@ -0,0 +1,52 @@
lib/nghttp2_time.c | 38 ++++++++++----------------------------
1 file changed, 10 insertions(+), 28 deletions(-)
diff --git a/lib/nghttp2_time.c b/lib/nghttp2_time.c
index 148ccfdc..355b225a 100644
--- a/lib/nghttp2_time.c
+++ b/lib/nghttp2_time.c
@@ -30,34 +30,16 @@
#include <time.h>
-#if !defined(HAVE_GETTICKCOUNT64) || defined(__CYGWIN__)
-static uint64_t time_now_sec(void) {
- time_t t = time(NULL);
-
- if (t == -1) {
- return 0;
- }
-
- return (uint64_t)t;
+typedef union
+{
+ unsigned __int64 scalar;
+ FILETIME ft_struct;
}
-#endif /* !HAVE_GETTICKCOUNT64 || __CYGWIN__ */
-
-#if defined(HAVE_GETTICKCOUNT64) && !defined(__CYGWIN__)
-uint64_t nghttp2_time_now_sec(void) { return GetTickCount64() / 1000; }
-#elif defined(HAVE_CLOCK_GETTIME) && defined(HAVE_DECL_CLOCK_MONOTONIC) && \
- HAVE_DECL_CLOCK_MONOTONIC
-uint64_t nghttp2_time_now_sec(void) {
- struct timespec tp;
- int rv = clock_gettime(CLOCK_MONOTONIC, &tp);
-
- if (rv == -1) {
- return time_now_sec();
- }
+ftime_t;
- return (uint64_t)tp.tv_sec;
+uint64_t nghttp2_time_now_sec(void)
+{
+ ftime_t ftime;
+ GetSystemTimeAsFileTime(&(ftime.ft_struct));
+ return ftime.scalar / 10000000ULL;
}
-#else /* (!HAVE_CLOCK_GETTIME || !HAVE_DECL_CLOCK_MONOTONIC) && \
- (!HAVE_GETTICKCOUNT64 || __CYGWIN__)) */
-uint64_t nghttp2_time_now_sec(void) { return time_now_sec(); }
-#endif /* (!HAVE_CLOCK_GETTIME || !HAVE_DECL_CLOCK_MONOTONIC) && \
- (!HAVE_GETTICKCOUNT64 || __CYGWIN__)) */

View File

@ -0,0 +1,34 @@
src/tool_cb_wrt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c
index b783866..645a3cf 100644
--- a/src/tool_cb_wrt.c
+++ b/src/tool_cb_wrt.c
@@ -237,7 +237,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
if(isatty(fileno(outs->stream)) &&
GetConsoleScreenBufferInfo((HANDLE)fhnd, &console_info)) {
wchar_t *wc_buf;
- DWORD wc_len;
+ DWORD wc_len, chars_written;
unsigned char *rbuf = (unsigned char *)buffer;
DWORD rlen = (DWORD)bytes;
@@ -292,7 +292,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
(HANDLE) fhnd,
prefix,
prefix[1] ? 2 : 1,
- NULL,
+ &chars_written,
NULL)) {
return CURL_WRITEFUNC_ERROR;
}
@@ -351,7 +351,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
(HANDLE) fhnd,
wc_buf,
wc_len,
- NULL,
+ &chars_written,
NULL)) {
free(wc_buf);
return CURL_WRITEFUNC_ERROR;

View File

@ -1,17 +1,20 @@
diff --git "a/D:\\_Sandbox\\curl\\libssh2-x64\\src\\session.c.orig" "b/D:\\_Sandbox\\curl\\libssh2-x64\\src\\session.c"
index e439acd..476a497 100644
--- "a/src/session.c"
+++ "b/src/session.c"
@@ -58,6 +58,8 @@
#include "mac.h"
#include "misc.h"
src/session.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/session.c b/src/session.c
index 2d77b05..79809cc 100644
--- a/src/session.c
+++ b/src/session.c
@@ -68,6 +68,8 @@
#undef libssh2_usec_t
#endif
+#define DIFFTIME(_b,_a) ((double)((_b) - (_a)))
+
/* libssh2_default_alloc
*/
static
@@ -610,7 +612,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
@@ -628,7 +630,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
(seconds_to_next == 0 ||
ms_to_next > session->api_timeout)) {
time_t now = time(NULL);