Skip to content

Commit 6e251e7

Browse files
authored
Update ponylang/ssl to 2.0.1 (#134)
* Pick up bug fix in ponylang/ssl dependency * Update CI to use ssl=libressl instead of ssl=0.9.0 Switch from the removed openssl_0.9.0 define to the libressl define. Windows builds now download and build LibreSSL from source. * Fix LibreSSL build for Windows arm64
1 parent 9466c79 commit 6e251e7

File tree

7 files changed

+107
-9
lines changed

7 files changed

+107
-9
lines changed

.github/workflows/breakage-against-linux-ponyc-latest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v6.0.2
1919
- name: Test
20-
run: make test ssl=0.9.0 config=debug
20+
run: make test ssl=libressl config=debug
2121
- name: Send alert on failure
2222
if: ${{ failure() }}
2323
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5
@@ -39,7 +39,7 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v6.0.2
4141
- name: Test
42-
run: make test ssl=0.9.0 config=debug
42+
run: make test ssl=libressl config=debug
4343
- name: Send alert on failure
4444
if: ${{ failure() }}
4545
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5

.github/workflows/breakage-against-windows-ponyc-latest.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ jobs:
2020
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/corral-x86-64-pc-windows-msvc.zip -OutFile C:\corral.zip;
2121
Expand-Archive -Force -Path C:\corral.zip -DestinationPath C:\ponyc;
2222
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
23+
- name: cache SSL libs
24+
id: restore-libs
25+
uses: actions/cache@v5.0.3
26+
with:
27+
path: |
28+
ssl.lib
29+
crypto.lib
30+
tls.lib
31+
key: rootlibs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('make.ps1') }}
32+
- name: build SSL libs
33+
if: steps.restore-libs.outputs.cache-hit != 'true'
34+
run: .\make.ps1 -Command libs 2>&1;
35+
- name: Test
36+
run: |
37+
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
2338
.\make.ps1 -Command test 2>&1;
2439
- name: Send alert on failure
2540
if: ${{ failure() }}

.github/workflows/pr.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v6.0.2
2727
- name: Test
28-
run: make test config=debug ssl=0.9.0
28+
run: make test config=debug ssl=libressl
2929

3030
libressl-4-vs-ponyc-release:
3131
name: LibreSSL 4.x with most recent ponyc release
@@ -35,7 +35,7 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v6.0.2
3737
- name: Test
38-
run: make test config=debug ssl=0.9.0
38+
run: make test config=debug ssl=libressl
3939

4040
openssl-1-vs-ponyc-release:
4141
name: OpenSSL 1.x with most recent ponyc release
@@ -69,6 +69,21 @@ jobs:
6969
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/corral-x86-64-pc-windows-msvc.zip -OutFile C:\corral.zip;
7070
Expand-Archive -Force -Path C:\corral.zip -DestinationPath C:\ponyc;
7171
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
72+
- name: cache SSL libs
73+
id: restore-libs
74+
uses: actions/cache@v5.0.3
75+
with:
76+
path: |
77+
ssl.lib
78+
crypto.lib
79+
tls.lib
80+
key: rootlibs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('make.ps1') }}
81+
- name: build SSL libs
82+
if: steps.restore-libs.outputs.cache-hit != 'true'
83+
run: .\make.ps1 -Command libs 2>&1;
84+
- name: Test
85+
run: |
86+
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
7287
.\make.ps1 -Command test 2>&1;
7388
7489
windows-arm64-vs-ponyc-release:
@@ -83,4 +98,19 @@ jobs:
8398
Invoke-WebRequest https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/corral-arm64-pc-windows-msvc.zip -OutFile C:\corral.zip;
8499
Expand-Archive -Force -Path C:\corral.zip -DestinationPath C:\ponyc;
85100
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
101+
- name: cache SSL libs
102+
id: restore-libs
103+
uses: actions/cache@v5.0.3
104+
with:
105+
path: |
106+
ssl.lib
107+
crypto.lib
108+
tls.lib
109+
key: rootlibs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('make.ps1') }}
110+
- name: build SSL libs
111+
if: steps.restore-libs.outputs.cache-hit != 'true'
112+
run: .\make.ps1 -Command libs 2>&1;
113+
- name: Test
114+
run: |
115+
$env:PATH = 'C:\ponyc\bin;' + $env:PATH;
86116
.\make.ps1 -Command test 2>&1;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Update ponylang/ssl to 2.0.1
2+
3+
Updates the ponylang/ssl dependency to 2.0.1 to pick up a bug fix.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ ifeq (,$(filter $(MAKECMDGOALS),clean docs realclean TAGS))
3131
SSL = -Dopenssl_3.0.x
3232
else ifeq ($(ssl), 1.1.x)
3333
SSL = -Dopenssl_1.1.x
34-
else ifeq ($(ssl), 0.9.0)
35-
SSL = -Dopenssl_0.9.0
34+
else ifeq ($(ssl), libressl)
35+
SSL = -Dlibressl
3636
else
3737
$(error Unknown SSL version "$(ssl)". Must set using 'ssl=FOO')
3838
endif

corral.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"deps": [
33
{
44
"locator": "github.com/ponylang/ssl.git",
5-
"version": "1.0.1"
5+
"version": "2.0.1"
66
}
77
],
88
"packages": [

make.ps1

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ else
5353
throw "Invalid -Config path '$Config'; must be one of (Debug, Release)."
5454
}
5555

56-
# $libsDir = Join-Path -Path $rootDir -ChildPath "build/libs"
56+
$libsDir = Join-Path -Path $rootDir -ChildPath "build/libs"
5757

5858
if (($Version -eq "") -and (Test-Path -Path "$rootDir\VERSION"))
5959
{
6060
$Version = (Get-Content "$rootDir\VERSION") + "-" + (& git 'rev-parse' '--short' '--verify' 'HEAD^')
6161
}
6262

63-
$ponyArgs = "--define openssl_0.9.0"
63+
$ponyArgs = "--define libressl --path $rootDir"
6464

6565
Write-Host "Configuration: $Config"
6666
Write-Host "Version: $Version"
@@ -88,6 +88,45 @@ if (($Command -ne "clean") -and (Test-Path -Path "$rootDir\VERSION"))
8888
}
8989
}
9090

91+
function BuildLibs
92+
{
93+
# When upgrading, change $libreSsl, $libreSslLib, and the copied libs below
94+
$libreSsl = "libressl-3.9.1"
95+
96+
if (-not ((Test-Path "$rootDir/crypto.lib") -and (Test-Path "$rootDir/ssl.lib")))
97+
{
98+
$libreSslSrc = Join-Path -Path $libsDir -ChildPath $libreSsl
99+
100+
if (-not (Test-Path $libreSslSrc))
101+
{
102+
$libreSslTgz = "$libreSsl.tar.gz"
103+
$libreSslTgzTgt = Join-Path -Path $libsDir -ChildPath $libreSslTgz
104+
if (-not (Test-Path $libreSslTgzTgt)) { Invoke-WebRequest -TimeoutSec 300 -Uri "https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/$libreSslTgz" -OutFile $libreSslTgzTgt }
105+
tar -xvzf "$libreSslTgzTgt" -C "$libsDir"
106+
if ($LastExitCode -ne 0) { throw "Error downloading and extracting $libreSslTgz" }
107+
}
108+
109+
$libreSslLib = Join-Path -Path $libsDir -ChildPath "lib/ssl-53.lib"
110+
111+
if (-not (Test-Path $libreSslLib))
112+
{
113+
Push-Location $libreSslSrc
114+
(Get-Content "$libreSslSrc\CMakeLists.txt").replace('add_definitions(-Dinline=__inline)', "add_definitions(-Dinline=__inline)`nadd_definitions(-DPATH_MAX=255)") | Set-Content "$libreSslSrc\CMakeLists.txt"
115+
if ($Arch -ieq 'arm64') { $cmakeArch = 'ARM64' } else { $cmakeArch = 'x64' }
116+
cmake.exe $libreSslSrc -Thost=x64 -A $cmakeArch -DCMAKE_INSTALL_PREFIX="$libsDir" -DCMAKE_BUILD_TYPE="Release"
117+
if ($LastExitCode -ne 0) { Pop-Location; throw "Error configuring $libreSsl" }
118+
cmake.exe --build . --target install --config Release
119+
if ($LastExitCode -ne 0) { Pop-Location; throw "Error building $libreSsl" }
120+
Pop-Location
121+
}
122+
123+
# copy to the root dir (i.e. PONYPATH) for linking
124+
Copy-Item -Force -Path "$libsDir/lib/ssl.lib" -Destination "$rootDir/ssl.lib"
125+
Copy-Item -Force -Path "$libsDir/lib/crypto.lib" -Destination "$rootDir/crypto.lib"
126+
Copy-Item -Force -Path "$libsDir/lib/tls.lib" -Destination "$rootDir/tls.lib"
127+
}
128+
}
129+
91130
function BuildTarget
92131
{
93132
$binaryFile = Join-Path -Path $buildDir -ChildPath "$target.exe"
@@ -239,6 +278,17 @@ switch ($Command.ToLower())
239278
break
240279
}
241280

281+
"libs"
282+
{
283+
if (-not (Test-Path $libsDir))
284+
{
285+
mkdir "$libsDir"
286+
}
287+
288+
BuildLibs
289+
break
290+
}
291+
242292
default
243293
{
244294
throw "Unknown command '$Command'; must be one of (libs, build, test, install, package, clean, distclean)."

0 commit comments

Comments
 (0)