Skip to content

Commit 734c1b1

Browse files
committed
Add build infrastructure for OpenSSL and LibSSH
0 parents  commit 734c1b1

14 files changed

Lines changed: 821 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: CI
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
build-linux:
7+
name: "Build - Linux"
8+
runs-on: ubuntu-latest
9+
container: wpilib/ubuntu-base:18.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
submodules: true
14+
15+
- name: Build
16+
run: ./gradlew build
17+
18+
- uses: actions/upload-artifact@v2
19+
with:
20+
name: Linux
21+
path: build/allOutputs
22+
23+
build-windows:
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- artifact-name: Win64
29+
architecture: x64
30+
vc: vcvars64.bat
31+
- artifact-name: Win32
32+
architecture: x86
33+
vc: vcvars32.bat
34+
name: "Build - ${{ matrix.artifact-name }}"
35+
runs-on: windows-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
with:
39+
submodules: true
40+
41+
- uses: actions/setup-java@v1
42+
with:
43+
java-version: 11
44+
architecture: ${{ matrix.architecture }}
45+
46+
- uses: ilammy/setup-nasm@v1
47+
48+
- name: Build with Gradle
49+
run: |
50+
@call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\${{ matrix.vc }}"
51+
gradlew build
52+
shell: cmd
53+
54+
- uses: actions/upload-artifact@v2
55+
with:
56+
name: ${{ matrix.artifact-name }}
57+
path: build/allOutputs
58+
59+
build-macos:
60+
env:
61+
MACOSX_DEPLOYMENT_TARGET: 10.14
62+
name: "Build - macOS"
63+
runs-on: macos-latest
64+
steps:
65+
- uses: actions/checkout@v2
66+
with:
67+
submodules: true
68+
69+
- name: Build
70+
run: ./gradlew build
71+
72+
- uses: actions/upload-artifact@v2
73+
with:
74+
name: macOS
75+
path: build/allOutputs
76+
77+
combine:
78+
name: Combine
79+
needs: [ build-linux, build-windows, build-macos ]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v2
83+
with:
84+
repository: wpilibsuite/build-tools
85+
- uses: actions/download-artifact@v2
86+
with:
87+
path: combiner/products/build/allOutputs
88+
- name: Flatten Artifacts
89+
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/
90+
- uses: actions/setup-java@v1
91+
with:
92+
java-version: 11
93+
- name: Combine
94+
if: |
95+
!startsWith(github.ref, 'refs/tags/v')
96+
run: ./gradlew publish -Pthirdparty
97+
working-directory: combiner
98+
- name: Combine (Release)
99+
if: |
100+
github.repository_owner == 'wpilibsuite' &&
101+
startsWith(github.ref, 'refs/tags/v')
102+
run: |
103+
./gradlew publish -Pthirdparty
104+
./gradlew publish -Pthirdparty -PreleaseRepoPublish
105+
working-directory: combiner
106+
env:
107+
RUN_AZURE_ARTIFACTORY_RELEASE: 'TRUE'
108+
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
109+
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
110+
- uses: actions/upload-artifact@v2
111+
with:
112+
name: Maven
113+
path: ~/releases

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build-*
2+
install-*
3+
.gradle
4+
.idea/
5+
.settings
6+
.vscode
7+
build

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "libssh-mirror"]
2+
path = libssh-mirror
3+
url = https://gitlab.com/libssh/libssh-mirror
4+
[submodule "openssl"]
5+
path = openssl
6+
url = https://github.com/openssl/openssl

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# thirdparty-libssh
2+
3+
This repo contains the build tools to build [libssh](https://www.libssh.org) with [OpenSSL](https://www.openssl.org) as the backend. OpenSSL is built by first configuring with `perl Configure no-shared` to build a static library. LibSSH is built with CMake. The two libraries are then merged together to form one static library for distribution.
4+
5+
### Building Instructions
6+
7+
`./gradlew build` will initiate the build for your platform. The built headers, sources, and libraries will be placed in `build/allOutputs`. Note that you **must** use a VS Developer Prompt on Windows.

build.gradle

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import org.gradle.internal.os.OperatingSystem
2+
3+
plugins {
4+
id "maven-publish"
5+
}
6+
7+
// Project Version
8+
ext.pub_version = "0.95-1"
9+
10+
static def get_platform() {
11+
def platform
12+
def os_name = System.getProperty("os.name")
13+
def os_arch = System.getProperty("os.arch")
14+
15+
if (os_arch == 'amd64') {
16+
os_arch = 'x86_64'
17+
} else if (os_arch == 'i386') {
18+
os_arch = 'x86'
19+
}
20+
21+
if (OperatingSystem.current().isWindows()) {
22+
platform = "windows-${os_arch}"
23+
} else if (OperatingSystem.current().isLinux()) {
24+
platform = "linux-${os_arch}"
25+
} else if (OperatingSystem.current().isMacOsX()) {
26+
platform = "osx-${os_arch}"
27+
} else {
28+
platform = "${os_name}-${os_arch}"
29+
}
30+
return platform
31+
}
32+
33+
static def get_platform_path(platform) {
34+
if (platform == "linux-athena") {
35+
return "linux/athena"
36+
} else if (platform == "linux-raspbian") {
37+
return "linux/raspbian"
38+
} else if (platform == "linux-aarch64bionic") {
39+
return "linux/aarch64bionic"
40+
} else if (platform == "linux-x86") {
41+
return "linux/x86"
42+
} else if (platform == "linux-x86_64") {
43+
return "linux/x86-64"
44+
} else if (platform == "osx-x86") {
45+
return "osx/x86"
46+
} else if (platform == "osx-x86_64") {
47+
return "osx/x86-64"
48+
} else if (platform == "windows-x86") {
49+
return "windows/x86"
50+
} else if (platform == "windows-x86_64") {
51+
return "windows/x86-64"
52+
} else {
53+
return ""
54+
}
55+
}
56+
57+
ext.platform = get_platform()
58+
ext.platform_path = get_platform_path(ext.platform)
59+
ext.platform_classifier = ext.platform.replaceFirst('-', '').replace('_', '-')
60+
61+
// Get the number of processors available to build.
62+
ext.processors = Runtime.runtime.availableProcessors()
63+
64+
ext.openssl_dir = file("openssl")
65+
ext.openssl_install = file("install-openssl")
66+
67+
ext.libssh_dir = file("libssh-mirror")
68+
ext.libssh_build = file("build-libssh")
69+
70+
apply from: "openssl.gradle"
71+
apply from: "libssh.gradle"
72+
73+
// Outputs for publishing
74+
def outputs_dir = file("$buildDir/allOutputs")
75+
task copyAllOutputs(type: Copy) {
76+
destinationDir outputs_dir
77+
}
78+
79+
ext.addTaskToCopyAllOutputs = { task ->
80+
copyAllOutputs.dependsOn task
81+
copyAllOutputs.inputs.file task.archivePath
82+
copyAllOutputs.from task.archivePath
83+
}
84+
85+
task clean {
86+
doLast {
87+
rootDir.eachDir {dir ->
88+
if (dir.name.startsWith("build") || dir.name.startsWith("install"))
89+
delete dir
90+
}
91+
}
92+
}
93+
94+
task build {
95+
dependsOn copyAllOutputs
96+
}
97+
98+
apply from: "publish.gradle"

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)