Skip to content

Commit b3e5915

Browse files
author
Richard Pospesel
committed
build: add MSYS2 PKGBUILD script to build
1 parent 1435386 commit b3e5915

File tree

6 files changed

+65
-2
lines changed

6 files changed

+65
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
export PATH=$(cygpath -u ${JAVA_HOME})/bin:$PATH
8080
mkdir -p build/debug
8181
cd build/debug
82-
cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../dist/debug -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JAVA_BINDINGS=ON -DBUILD_EXAMPLES=ON
82+
cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../dist/debug -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JAVA_BINDINGS=ON -DBUILD_EXAMPLES=ON -DBUILD_MSYS2_PKGBUILD=ON
8383
make
8484
make install
8585
- name: Archive Debug
@@ -97,7 +97,7 @@ jobs:
9797
export PATH=$(cygpath -u ${JAVA_HOME})/bin:$PATH
9898
mkdir -p build/release
9999
cd build/release
100-
cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../dist/release -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JAVA_BINDINGS=ON -DBUILD_EXAMPLES=ON
100+
cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../dist/release -DBUILD_PYTHON_BINDINGS=ON -DBUILD_JAVA_BINDINGS=ON -DBUILD_EXAMPLES=ON -DBUILD_MSYS2_PKGBUILD=ON
101101
make
102102
make install
103103
- name: Archive Release

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ option(BUILD_EXAMPLES "Build example targets" OFF)
7777
# Packages options
7878
option(BUILD_DEBIAN_SOURCE_PACKAGE "Build debian cgosling source package" OFF)
7979
option(BUILD_HOMEBREW_FORMULA "Build homebrew flask formula" OFF)
80+
option(BUILD_MSYS2_PKGBUILD "Build msys2 pkgbuild script" OFF)
8081

8182
# Documentation options
8283
option(BUILD_PAGES "Build webpages" OFF)

source/packages/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
add_subdirectory(debian-source)
22
add_subdirectory(homebrew-formula)
3+
add_subdirectory(msys2-pkgbuild)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if (BUILD_MSYS2_PKGBUILD)
2+
# generate msys2 PKGBUILD build script
3+
set(PKGBUILD_IN ${CMAKE_CURRENT_SOURCE_DIR}/PKGBUILD.in)
4+
set(PKGBUILD_OUT ${CMAKE_CURRENT_BINARY_DIR}/PKGBUILD)
5+
configure_file(${PKGBUILD_IN} ${PKGBUILD_OUT} @ONLY)
6+
7+
install(FILES ${PKGBUILD_OUT}
8+
DESTINATION ${CMAKE_INSTALL_DATADIR}/gosling/packages/msys2-pkgbuild)
9+
endif()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Maintainer: Richard Pospesel <richard@blueprintforfreespeech.net>
2+
3+
_realname=libcgosling
4+
pkgbase=mingw-w64-${_realname}
5+
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
6+
pkgver=0.2.2
7+
pkgrel=1
8+
pkgdesc="C bindings for Gosling crate"
9+
arch=('any')
10+
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
11+
url=https://github.com/blueprint-freespeech/gosling
12+
license=('BSD-3-Clause')
13+
source=("git+https://github.com/blueprint-freespeech/gosling?signed#tag=cgosling-v$@CGOSLING_VERSION@")
14+
sha256sums=('SKIP')
15+
validpgpkeys=(
16+
'BE7C914CC922CED9D93D23B7DE47360363F34B2C' # Richard Pospesel <richard@blueprintforfreespeech.net>
17+
)
18+
makedepends=(
19+
"git"
20+
"make"
21+
"${MINGW_PACKAGE_PREFIX}-cmake"
22+
"${MINGW_PACKAGE_PREFIX}-rust"
23+
"${MINGW_PACKAGE_PREFIX}-clang"
24+
)
25+
optdepends=("${MINGW_PACKAGE_PREFIX}-tor")
26+
27+
build() {
28+
${MINGW_PREFIX}/bin/cmake \
29+
-G "Unix Makefiles" \
30+
-S "${srcdir}/gosling" \
31+
-B "${srcdir}/build-${MSYSTEM}" \
32+
-DCMAKE_C_COMPILER="clang" \
33+
-DCMAKE_CXX_COMPILER="clang++" \
34+
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
35+
-DCMAKE_BUILD_TYPE=Release \
36+
37+
${MINGW_PREFIX}/bin/cmake --build "${srcdir}/build-${MSYSTEM}"
38+
}
39+
40+
package() {
41+
${MINGW_PREFIX}/bin/cmake --install "${srcdir}/build-${MSYSTEM}"
42+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# msys2-pkgbuild
2+
3+
This buillds an [MSYS2](https://www.msys2.org/) PKGBUILD script for the cgosling crate which can be used to build and install the libcgosling shared libs, static libs, and development headers.
4+
5+
## Building PKGBUILD script
6+
7+
```bash
8+
cd /path/to/libcgosling/PKGBUILD
9+
makepkg
10+
```

0 commit comments

Comments
 (0)