Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Add cross-openssl images (#3)
Browse files Browse the repository at this point in the history
* Workflow

* Fix time

* Remove?

* No build openssl

* Fix dockerfiles

* Alt build

* Fix shortcut

* Fix copy

* Different setup

* Cachable

* Deb rename

* -c

* test

* Test push

* Expand support

* Fix for bsd platforms

* Remove apt updates

* m

* fix

* pass args

* build combos

* illumos is solaris not bsd

* release

* solaris fix?

* test

* t

* slipt

* autogen?

* Solaris test

* Testing, removal of solaris

* test

* Upload

* Fix?

* pkg-config info

* t

* Deb patches

* Fixes

* ls

* Better repacking

* Fix broken Env Var

* Fix

* Change openssl version

* Changes

* Flags

* flags

* change

* fix

* fix

* fix musl

* Revert "Change openssl version"

This reverts commit b70b919.

* static?

* add

* fic

* Env for openssl location

* Test all

* No bsd fix

* Init README

* Changes

* Test

* Fix prefix

* Fix

* Switch how openssl is added

* Shell switch

* read write

* Fix freebsd

* ls

* test

* Cleanup

* Test more

* Cleanup

* Change download strat and testing

* fix url

* Fix panic

* better test

* Massive cleanup
  • Loading branch information
harmless-tech authored Jun 3, 2023
1 parent 1dad723 commit 38d46ce
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 0 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/cross-openssl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Build cross openssl images

on:
push:
branches: [ main ]
paths: [ .github/workflows/cross-openssl.yml, cross-openssl/** ]
pull_request:
branches: [ main ]
paths: [ .github/workflows/cross-openssl.yml, cross-openssl/** ]
workflow_dispatch:
schedule:
- cron: '0 3 * * 0'

jobs:
cross-openssl:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
build_combo: linux-x86_64
- target: x86_64-unknown-linux-musl
build_combo: linux-x86_64
- target: aarch64-unknown-linux-gnu
build_combo: linux-aarch64
- target: aarch64-unknown-linux-musl
build_combo: linux-aarch64
- target: x86_64-unknown-freebsd
build_combo: BSD-x86_64
- target: x86_64-unknown-netbsd
build_combo: BSD-x86_64
- target: x86_64-unknown-illumos
build_combo: solaris64-x86_64-gcc
- target: x86_64-sun-solaris
build_combo: solaris64-x86_64-gcc
- target: riscv64gc-unknown-linux-gnu
build_combo: linux64-riscv64
- target: powerpc64-unknown-linux-gnu
build_combo: linux-ppc64
- target: powerpc64le-unknown-linux-gnu
build_combo: linux-ppc64le
- target: s390x-unknown-linux-gnu
build_combo: linux64-s390x
- target: mips64-unknown-linux-gnuabi64
build_combo: linux64-mips64
- target: mips64-unknown-linux-muslabi64
build_combo: linux64-mips64
- target: mips64el-unknown-linux-gnuabi64
build_combo: linux64-mips64
- target: mips64el-unknown-linux-muslabi64
build_combo: linux64-mips64
- target: i686-unknown-linux-gnu
build_combo: linux-elf
- target: i686-unknown-linux-musl
build_combo: linux-elf
- target: i686-unknown-freebsd
build_combo: BSD-x86-elf
- target: armv7-unknown-linux-gnueabihf
build_combo: linux-armv4
- target: armv7-unknown-linux-musleabihf
build_combo: linux-armv4
- target: powerpc-unknown-linux-gnu
build_combo: linux-ppc
- target: mips-unknown-linux-gnu
build_combo: linux-mips32
- target: mips-unknown-linux-musl
build_combo: linux-mips32
- target: mipsel-unknown-linux-gnu
build_combo: linux-mips32
- target: mipsel-unknown-linux-musl
build_combo: linux-mips32
- target: x86_64-pc-windows-gnu
build_combo: mingw64
- target: i686-pc-windows-gnu
build_combo: mingw
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Docker Setup Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Docker Login
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get latest openssl
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./cross-openssl
run: echo "OPENSSL_VERSION=$(gh release view -R openssl/openssl --json tagName --jq '.tagName')" >> $GITHUB_ENV
- name: Download openssl
working-directory: ./cross-openssl
run: curl --retry 3 -fsSL https://www.openssl.org/source/${{ env.OPENSSL_VERSION }}.tar.gz -o openssl.tar.gz
- name: Move openssl
working-directory: ./cross-openssl
run: |
mkdir openssl
tar -xzvf openssl.tar.gz -C openssl --strip-components=1
- name: Vars
run: |
echo "BUILD_DATE=$(date --utc)" >> $GITHUB_ENV
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: ./cross-openssl
file: ./cross-openssl/Dockerfile
pull: true
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/cargo-prebuilt/cross-openssl:${{ matrix.target }}
labels: |
tech.harmless.cargo-prebuilt.name="cross-openssl"
tech.harmless.cargo-prebuilt.target="${{ matrix.target }}"
tech.harmless.cargo-prebuilt.openssl="${{ env.OPENSSL_VERSION }}"
tech.harmless.cargo-prebuilt.pull_request_build="${{ github.event_name == 'pull_request' }}"
tech.harmless.cargo-prebuilt.run_number="${{ github.run_number }}"
tech.harmless.cargo-prebuilt.repo="${{ github.repositoryUrl }}"
tech.harmless.cargo-prebuilt.build_date="${{ env.BUILD_DATE }}"
org.opencontainers.image.authors="cross-rs, harmless-tech, cargo-prebuilt"
build-args: |
TARGET=${{ matrix.target }}
BUILD_COMBO=${{ matrix.build_combo }}
platforms: linux/amd64
builder: ${{ steps.buildx.outputs.name }}
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,46 @@
- mipsel-unknown-linux-musl
- x86_64-pc-windows-gnu
- i686-pc-windows-gnu

## cross-openssl

### Changed

- Use cargo-auditable image as base.
- Add latest version of openssl.

### Usage

- See [Cross.toml](cross-openssl/Cross.toml).
- ghcr.io/cargo-prebuilt/cross-openssl:[TARGET](#supported-targets)

### Supported Targets

- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- x86_64-unknown-freebsd
- x86_64-unknown-netbsd
- x86_64-unknown-illumos
- x86_64-sun-solaris
- riscv64gc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- s390x-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- mips64-unknown-linux-muslabi64
- mips64el-unknown-linux-gnuabi64
- mips64el-unknown-linux-muslabi64
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- i686-unknown-freebsd
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
- powerpc-unknown-linux-gnu
- mips-unknown-linux-gnu
- mips-unknown-linux-musl
- mipsel-unknown-linux-gnu
- mipsel-unknown-linux-musl
- x86_64-pc-windows-gnu
- i686-pc-windows-gnu
83 changes: 83 additions & 0 deletions cross-openssl/Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-unknown-linux-gnu"

[target.x86_64-unknown-linux-musl]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-unknown-linux-musl"

[target.aarch64-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:aarch64-unknown-linux-gnu"

[target.aarch64-unknown-linux-musl]
image = "ghcr.io/cargo-prebuilt/cross-openssl:aarch64-unknown-linux-musl"

[target.x86_64-unknown-freebsd]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-unknown-freebsd"

[target.x86_64-unknown-netbsd]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-unknown-netbsd"

[target.x86_64-unknown-illumos]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-unknown-illumos"

[target.x86_64-sun-solaris]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-sun-solaris"

[target.riscv64gc-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:riscv64gc-unknown-linux-gnu"

[target.powerpc64-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:powerpc64-unknown-linux-gnu"

[target.powerpc64le-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:powerpc64le-unknown-linux-gnu"

[target.s390x-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:s390x-unknown-linux-gnu"

[target.mips64-unknown-linux-gnuabi64]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mips64-unknown-linux-gnuabi64"

[target.mips64-unknown-linux-muslabi64]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mips64-unknown-linux-muslabi64"

[target.mips64el-unknown-linux-gnuabi64]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mips64el-unknown-linux-gnuabi64"

[target.mips64el-unknown-linux-muslabi64]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mips64el-unknown-linux-muslabi64"

[target.i686-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:i686-unknown-linux-gnu"

[target.i686-unknown-linux-musl]
image = "ghcr.io/cargo-prebuilt/cross-openssl:i686-unknown-linux-musl"

[target.i686-unknown-freebsd]
image = "ghcr.io/cargo-prebuilt/cross-openssl:i686-unknown-freebsd"

[target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/cargo-prebuilt/cross-openssl:armv7-unknown-linux-gnueabihf"

[target.armv7-unknown-linux-musleabihf]
image = "ghcr.io/cargo-prebuilt/cross-openssl:armv7-unknown-linux-musleabihf"

[target.powerpc-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:powerpc-unknown-linux-gnu"

[target.mips-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mips-unknown-linux-gnu"

[target.mips-unknown-linux-musl]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mips-unknown-linux-musl"

[target.mipsel-unknown-linux-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mipsel-unknown-linux-gnu"

[target.mipsel-unknown-linux-musl]
image = "ghcr.io/cargo-prebuilt/cross-openssl:mipsel-unknown-linux-musl"

[target.x86_64-pc-windows-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:x86_64-pc-windows-gnu"

[target.i686-pc-windows-gnu]
image = "ghcr.io/cargo-prebuilt/cross-openssl:i686-pc-windows-gnu"
30 changes: 30 additions & 0 deletions cross-openssl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG TARGET
FROM ghcr.io/cargo-prebuilt/cross-auditable:$TARGET
ARG TARGET
ARG BUILD_COMBO

ENV OPENSSL_INCLUDE_DIR=$CROSS_SYSROOT/include
ENV OPENSSL_LIB_DIR=$CROSS_SYSROOT/lib

RUN --mount=type=bind,source=openssl,target=/openssl,rw <<EOT
cd /openssl

case "$CROSS_TOOLCHAIN_PREFIX" in
*freebsd*)
CC="$CROSS_TOOLCHAIN_PREFIX"gcc AR="$CROSS_TOOLCHAIN_PREFIX"ar ./Configure $BUILD_COMBO \
--libdir=lib --prefix=/usr/local --openssldir=/usr/local/ssl \
no-dso no-shared no-ssl3 no-tests no-comp \
no-legacy no-camellia no-idea no-seed
;;
*)
CC="$CROSS_TOOLCHAIN_PREFIX"gcc AR="$CROSS_TOOLCHAIN_PREFIX"ar ./Configure $BUILD_COMBO \
--libdir=lib --prefix=$CROSS_SYSROOT --openssldir=$CROSS_SYSROOT/ssl \
no-dso no-shared no-ssl3 no-tests no-comp \
no-legacy no-camellia no-idea no-seed
;;
esac

make "-j$(nproc)"
make "-j$(nproc)" install_sw
make "-j$(nproc)" install_ssldirs
EOT

0 comments on commit 38d46ce

Please sign in to comment.