| # Maintainer: Steve Jemens <sjemens@hotmail.com> |
| |
| _realname=xlnt |
| pkgbase=mingw-w64-${_realname} |
| pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" |
| pkgver=1.5.0 |
| pkgrel=2 |
| pkgdesc="User-friendly xlsx library for C++14 (mingw-w64)" |
| url="https://github.com/tfussell/xlnt" |
| license=('MIT') |
| arch=('any') |
| mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') |
| depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs") |
| makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" |
| "${MINGW_PACKAGE_PREFIX}-ninja" |
| "unzip") |
| options=('strip' '!debug' 'staticlibs') |
| source=("${_realname}-${pkgver}.zip"::"https://github.com/tfussell/xlnt/archive/v${pkgver}.zip") |
| noextract=("${_realname}-${pkgver}.zip") # bsdtar fails extracting the symlinks |
| sha256sums=('27db56b53745bf40e94edc531eb54ef67a75a40c9acc47609f0d8c8950b46d4c') |
| |
| prepare() { |
| unzip -oq "${_realname}-${pkgver}.zip" -d ${srcdir} |
| |
| # Causes error in clang, not so important |
| cd "${srcdir}/${_realname}-${pkgver}" |
| rm "third-party/libstudxml/version" |
| } |
| |
| build() { |
| declare -a _extra_config |
| if check_option "debug" "n"; then |
| _extra_config+=("-DCMAKE_BUILD_TYPE=Release") |
| else |
| _extra_config+=("-DCMAKE_BUILD_TYPE=Debug") |
| fi |
| |
| echo "Building static library" |
| [[ -d "${srcdir}/build-${CARCH}-static" ]] && rm -rf "${srcdir}/build-${CARCH}-static" |
| mkdir -p "${srcdir}/build-${CARCH}-static" && cd "${srcdir}/build-${CARCH}-static" |
| |
| MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ |
| ${MINGW_PREFIX}/bin/cmake.exe \ |
| -G "Ninja" \ |
| -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ |
| -DCMAKE_PREFIX_PATH=${MINGW_PREFIX} \ |
| "${_extra_config[@]}" \ |
| -DSTATIC=ON \ |
| -DTESTS=OFF \ |
| ../${_realname}-${pkgver} |
| |
| ${MINGW_PREFIX}/bin/cmake.exe --build ./ |
| |
| echo "Building shared library" |
| [[ -d "${srcdir}/build-${CARCH}-shared" ]] && rm -rf "${srcdir}/build-${CARCH}-shared" |
| mkdir -p "${srcdir}/build-${CARCH}-shared" && cd "${srcdir}/build-${CARCH}-shared" |
| |
| MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ |
| ${MINGW_PREFIX}/bin/cmake.exe \ |
| -G "Ninja" \ |
| -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ |
| -DCMAKE_PREFIX_PATH=${MINGW_PREFIX} \ |
| "${_extra_config[@]}" \ |
| -DSTATIC=OFF \ |
| -DTESTS=OFF \ |
| ../${_realname}-${pkgver} |
| |
| ${MINGW_PREFIX}/bin/cmake.exe --build ./ |
| } |
| |
| package() { |
| cd "${srcdir}/build-${CARCH}-static" |
| DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --build ./ --target install |
| |
| cd "${srcdir}/build-${CARCH}-shared" |
| DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --build ./ --target install |
| |
| cd "${srcdir}/${_realname}-${pkgver}" |
| install -Dm644 LICENSE.md "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" |
| } |