Skip to content

Commit afba797

Browse files
authored
Merge pull request #280 from LinuxJedi/easier-wolfssl
Dynamically build wolfSSL instead of stored binary
2 parents d02b4a4 + a45c6e3 commit afba797

File tree

5 files changed

+254
-93
lines changed

5 files changed

+254
-93
lines changed
-28.4 MB
Binary file not shown.

.github/workflows/debian-package.yml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
branches: [ '*' ]
88

9+
env:
10+
WOLFSSL_VERSION: master # Can be changed to specific tag like v5.6.4
11+
912
jobs:
1013
libwolfprov-standalone:
1114
runs-on: ubuntu-22.04
@@ -60,16 +63,50 @@ jobs:
6063
# List all tags
6164
git tag -l
6265
66+
# Cache wolfSSL to speed up builds:
67+
# - Git repository cache: Avoids re-cloning wolfSSL repo
68+
# - Complete build cache: Includes source, built packages, and artifacts
69+
# Cache keys include script hash to invalidate when install script changes
70+
- name: Cache wolfSSL git repository
71+
uses: actions/cache@v4
72+
with:
73+
path: /tmp/wolfssl-pkg/wolfssl/.git
74+
key: wolfssl-git-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}-${{ github.sha }}
75+
restore-keys: |
76+
wolfssl-git-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}-
77+
wolfssl-git-${{ env.WOLFSSL_VERSION }}-
78+
79+
- name: Cache wolfSSL source and build
80+
uses: actions/cache@v4
81+
with:
82+
path: |
83+
/tmp/wolfssl-pkg/wolfssl
84+
/tmp/wolfssl-pkg/*.deb
85+
/tmp/wolfssl-pkg/*.dsc
86+
/tmp/wolfssl-pkg/*.tar.gz
87+
key: wolfssl-complete-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}-${{ github.sha }}
88+
restore-keys: |
89+
wolfssl-complete-${{ env.WOLFSSL_VERSION }}-${{ hashFiles('wolfProvider/debian/install-wolfssl.sh') }}-
90+
6391
- name: Install wolfssl debian package
6492
run: |
6593
mkdir -p "/tmp/wolfssl-pkg"
6694
cd "/tmp/wolfssl-pkg"
6795
68-
# Install wolfssl packages
69-
chmod +x $GITHUB_WORKSPACE/debian/install-wolfssl.sh
70-
$GITHUB_WORKSPACE/debian/install-wolfssl.sh \
71-
$GITHUB_WORKSPACE/.github/packages/debian-wolfssl.tar.gz \
72-
"/tmp/wolfssl-pkg"
96+
# Check if cached packages exist
97+
if ls *.deb 1> /dev/null 2>&1; then
98+
echo "Found cached wolfSSL packages, installing them..."
99+
dpkg -i *.deb || apt-get install -f -y
100+
else
101+
echo "No cached packages found, building from source..."
102+
# Install wolfssl packages with specified version
103+
chmod +x $GITHUB_WORKSPACE/debian/install-wolfssl.sh
104+
if [ "$WOLFSSL_VERSION" != "master" ]; then
105+
$GITHUB_WORKSPACE/debian/install-wolfssl.sh --tag "$WOLFSSL_VERSION" "/tmp/wolfssl-pkg"
106+
else
107+
$GITHUB_WORKSPACE/debian/install-wolfssl.sh "/tmp/wolfssl-pkg"
108+
fi
109+
fi
73110
74111
# Create wolfprov-packages directory and move wolfssl files there
75112
mkdir -p "/tmp/wolfprov-packages"

.github/workflows/libwebsockets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
run: |
7474
mkdir build
7575
cd build
76-
cmake ..
76+
cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.5
7777
make -j$(nproc)
7878
sudo make install
7979

README-packaging.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,32 @@ To use a build from CI for local install, download the artifacts from the Debian
2222

2323
## Install
2424

25-
If not already done, install the WolfSSL Debian package. The non-FIPS version is available in this repo and is installed by the script below. This step is only needed once, and can be done prior to the `build-wolfprovider.sh` step above.
25+
If not already done, install the WolfSSL Debian package. The script below will clone the wolfSSL repository and build packages from source. This step is only needed once, and can be done prior to the `build-wolfprovider.sh` step above.
26+
27+
Basic usage (builds master branch in temporary directory):
28+
```
29+
./debian/install-wolfssl.sh
30+
```
31+
32+
Build master branch in specific directory:
33+
```
34+
./debian/install-wolfssl.sh /path/to/working/directory
2635
```
27-
./debian/install-wolfssl.sh ./.github/packages/debian-wolfssl.tar.gz
36+
37+
Build specific tag or branch:
2838
```
39+
./debian/install-wolfssl.sh --tag v5.6.4
40+
./debian/install-wolfssl.sh --tag v5.6.4 /path/to/working/directory
41+
```
42+
43+
Build with debug mode enabled:
44+
```
45+
./debian/install-wolfssl.sh --debug
46+
./debian/install-wolfssl.sh --debug --tag v5.6.4
47+
./debian/install-wolfssl.sh --debug --tag v5.6.4 /path/to/working/directory
48+
```
49+
50+
The script will automatically detect if wolfSSL is already cloned in the working directory and reuse it. For older tags that don't include debian packaging files, the script will automatically backport the packaging from master.
2951

3052
For the script above, some systems may require additional packages:
3153
```

0 commit comments

Comments
 (0)