Skip to content

Commit

Permalink
bundle Win32.pm (#559)
Browse files Browse the repository at this point in the history
* add a script for building OpenSSL

* bundle Win32.pm

* fix bash flags

* enable retry when downloading OpenSSL

* add Win32.pm into pre-installed module  list

* fix prefix of OpenSSL

* fix the package name of Win32

* fix perfix of OpenSSL

* fix the prefix of OpenSSL

* add .github/build-openssl-win32.sh
  • Loading branch information
shogo82148 committed Jan 10, 2021
1 parent a5b5d0c commit 2650bbb
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/build-openssl-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo "::group::download OpenSSL source"
(
set -eux
cd "$RUNNER_TEMP"
curl -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
curl --retry 3 -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
)
echo "::endgroup::"

Expand Down
2 changes: 1 addition & 1 deletion .github/build-openssl-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "::group::download OpenSSL source"
(
set -eux
cd "$RUNNER_TEMP"
curl -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
curl --retry 3 -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
)
echo "::endgroup::"

Expand Down
47 changes: 47 additions & 0 deletions .github/build-openssl-win32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# bundle OpenSSL for better reproducibility.

set -e

OPENSSL_VERSION=1_1_1i
ROOT=$(cd "$(dirname "$0")" && pwd)
: "${RUNNER_TEMP:=$ROOT/working}"
: "${RUNNER_TOOL_CACHE:=$RUNNER_TEMP/dist}"
PERL_DIR=$PERL_VERSION
if [[ "x$PERL_MULTI_THREAD" != "x" ]]; then
PERL_DIR="$PERL_DIR-thr"
fi
PREFIX=$(cygpath "$RUNNER_TOOL_CACHE\\perl\\$PERL_DIR\\x64")

# detect the number of CPU Core
JOBS=$(nproc)

mkdir -p "$RUNNER_TEMP"
cd "$RUNNER_TEMP"

echo "::group::download OpenSSL source"
(
set -eux
cd "$RUNNER_TEMP"
curl --retry 3 -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
)
echo "::endgroup::"

echo "::group::extract OpenSSL source"
(
set -eux
cd "$RUNNER_TEMP"
tar zxvf openssl.tar.gz
)
echo "::endgroup::"

echo "::group::build OpenSSL"
(
set -eux
cd "$RUNNER_TEMP/openssl-OpenSSL_$OPENSSL_VERSION"
./Configure --prefix="$PREFIX" mingw64
make "-j$JOBS"
make install_sw install_ssldirs
)
echo "::endgroup::"
29 changes: 8 additions & 21 deletions .github/workflows/win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "scripts/windows/**"
- "scripts/lib/Devel/**"
- ".github/workflows/win32.yml"
- ".github/build-openssl-win32.sh"
push:
branches:
- "releases/*"
Expand Down Expand Up @@ -56,22 +57,16 @@ jobs:
strategy:
fail-fast: false
matrix: ${{fromJson(needs.list.outputs.matrix)}}
env:
PERL_VERSION: ${{ matrix.perl }}
steps:
- uses: actions/checkout@v2

- uses: msys2/setup-msys2@v2
with:
install: make mingw-w64-x86_64-gcc nasm
- name: install OpenSSL
run: |
set -eux
OPENSSL_VERSION=1_1_1i
curl --retry 3 -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
tar xzf openssl.tar.gz
cd "openssl-OpenSSL_$OPENSSL_VERSION"
perl Configure --prefix="$(cygpath "$RUNNER_TOOL_CACHE\perl\${{ matrix.perl }}\x64")" mingw64
make "-j$(nproc)"
make install_sw install_ssldirs
run: .github/build-openssl-win32.sh
shell: "msys2 {0}"

- name: setup host perl
Expand Down Expand Up @@ -109,7 +104,6 @@ jobs:
shell: cmd
run: perl build.pl
env:
PERL_VERSION: ${{ matrix.perl }}
PERL5LIB: ${{ github.workspace }}/scripts/windows/local/lib/perl5
# PERL_DL_DEBUG: "10" # enables debugging
working-directory: ./scripts/windows
Expand Down Expand Up @@ -157,22 +151,17 @@ jobs:
strategy:
fail-fast: false
matrix: ${{fromJson(needs.list.outputs.matrix)}}
env:
PERL_VERSION: ${{ matrix.perl }}
PERL_MULTI_THREAD: "1"
steps:
- uses: actions/checkout@v2

- uses: msys2/setup-msys2@v2
with:
install: make mingw-w64-x86_64-gcc nasm
- name: install OpenSSL
run: |
set -eux
OPENSSL_VERSION=1_1_1i
curl --retry 3 -sSL "https://github.com/openssl/openssl/archive/OpenSSL_$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz
tar xzf openssl.tar.gz
cd "openssl-OpenSSL_$OPENSSL_VERSION"
perl Configure --prefix="$(cygpath "$RUNNER_TOOL_CACHE\perl\${{ matrix.perl }}-thr\x64")" mingw64
make "-j$(nproc)"
make install_sw
run: .github/build-openssl-win32.sh
shell: "msys2 {0}"

- name: setup host perl
Expand Down Expand Up @@ -210,10 +199,8 @@ jobs:
shell: cmd
run: perl build.pl
env:
PERL_VERSION: ${{ matrix.perl }}
PERL5LIB: ${{ github.workspace }}/scripts/windows/local/lib/perl5
# PERL_DL_DEBUG: "10" # enables debugging
PERL_MULTI_THREAD: "1"
working-directory: ./scripts/windows

- uses: actions/upload-artifact@v1
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ The following Perl scripts are pre-installed for convenience.
- Net::SSLeay
- IO::Socket::SSL
- Mozilla::CA
- Win32 (installed from CPAN in perl 5.8.3 or earlier. From perl 5.8.4, it is installed as a core module.)

## Actions::Core

Expand Down
3 changes: 3 additions & 0 deletions scripts/windows/build.pl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ sub run {
};

group "install common CPAN modules" => sub {
# Win32
cpan_install('https://cpan.metacpan.org/authors/id/J/JD/JDB/Win32-0.54.tar.gz', 'Win32', '5.6.0', '5.8.3');

# JSON
cpan_install('https://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/JSON-4.02.tar.gz', 'JSON', '5.5.3');

Expand Down

0 comments on commit 2650bbb

Please sign in to comment.