Skip to content

Commit

Permalink
Merge pull request msys2#19113 from lazka/libaribcaption-static
Browse files Browse the repository at this point in the history
libaribcaption: add static build
  • Loading branch information
lazka authored Nov 18, 2023
2 parents 3d02e1f + 3efb26f commit 7431dac
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions mingw-w64-libaribcaption/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _realname=libaribcaption
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.1.1
pkgrel=1
pkgrel=2
pkgdesc="Portable ARIB STD-B24 Caption Decoder/Renderer (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
Expand All @@ -23,16 +23,31 @@ source=("https://github.com/xqq/libaribcaption/archive/refs/tags/v${pkgver}.tar.
sha256sums=('278d03a0a662d00a46178afc64f32535ede2d78c603842b6fd1c55fa9cd44683')

build() {
cd "${srcdir}/${_realname}-${pkgver}"
mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi

msg2 "Building static library"
[[ -d "${srcdir}"/build-${MSYSTEM}-static ]] && rm -rf "${srcdir}"/build-${MSYSTEM}-static
mkdir -p "${srcdir}"/build-${MSYSTEM}-static && cd "${srcdir}"/build-${MSYSTEM}-static

MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
"${MINGW_PREFIX}"/bin/cmake.exe \
-GNinja \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
"${extra_config[@]}" \
-DBUILD_SHARED_LIBS=OFF \
../${_realname}-${pkgver}

"${MINGW_PREFIX}"/bin/cmake.exe --build .

msg2 "Building shared library"
[[ -d "${srcdir}"/build-${MSYSTEM}-shared ]] && rm -rf "${srcdir}"/build-${MSYSTEM}-shared
mkdir -p "${srcdir}"/build-${MSYSTEM}-shared && cd "${srcdir}"/build-${MSYSTEM}-shared

MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
"${MINGW_PREFIX}"/bin/cmake.exe \
-GNinja \
Expand All @@ -45,8 +60,10 @@ build() {
}

package() {
cd "${srcdir}/build-${MSYSTEM}"
cd "${srcdir}"/build-${MSYSTEM}-static
DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install .

cd "${srcdir}"/build-${MSYSTEM}-shared
DESTDIR="${pkgdir}" "${MINGW_PREFIX}"/bin/cmake.exe --install .

install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
Expand Down

0 comments on commit 7431dac

Please sign in to comment.