Date: Monday, April 26, 2021 @ 18:38:06 Author: felixonmars Revision: 924555
addpkg: haskell-persistent-mysql 2.12.0.0-1 Added: haskell-persistent-mysql/ haskell-persistent-mysql/repos/ haskell-persistent-mysql/trunk/ haskell-persistent-mysql/trunk/PKGBUILD ----------+ PKGBUILD | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) Added: haskell-persistent-mysql/trunk/PKGBUILD =================================================================== --- haskell-persistent-mysql/trunk/PKGBUILD (rev 0) +++ haskell-persistent-mysql/trunk/PKGBUILD 2021-04-26 18:38:06 UTC (rev 924555) @@ -0,0 +1,65 @@ +# Maintainer: Felix Yan <felixonm...@archlinux.org> + +_hkgname=persistent-mysql +pkgname=haskell-persistent-mysql +pkgver=2.12.0.0 +pkgrel=1 +pkgdesc="Backend for the persistent library using MySQL database server." +url="http://www.yesodweb.com/book/persistent" +license=("MIT") +arch=('x86_64') +depends=('ghc-libs' 'haskell-aeson' 'haskell-blaze-builder' 'haskell-conduit' 'haskell-monad-logger' + 'haskell-mysql' 'haskell-mysql-simple' 'haskell-persistent' 'haskell-resource-pool' + 'haskell-resourcet' 'haskell-unliftio-core') +makedepends=('ghc' 'haskell-hunit' 'haskell-quickcheck' 'haskell-fast-logger' 'haskell-hspec' + 'haskell-persistent-qq' 'haskell-persistent-test' 'haskell-quickcheck-instances') +#checkdepends=('percona-server' 'percona-server-clients') +checkdepends=('mariadb') +source=("https://hackage.haskell.org/packages/archive/$_hkgname/$pkgver/$_hkgname-$pkgver.tar.gz") +sha256sums=('e3a6689ff60dbc5b33d594d41c146d57e6a6db2e6845177623295f04d9a47c2f') + +build() { + cd $_hkgname-$pkgver + + runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \ + --prefix=/usr --docdir=/usr/share/doc/$pkgname --enable-tests \ + --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid \ + --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \ + --ghc-option='-pie' + + runhaskell Setup build + runhaskell Setup register --gen-script + runhaskell Setup unregister --gen-script + sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh + sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh +} + +check() { + cd $_hkgname-$pkgver + mkdir -p /tmp/mysql_test + # TODO: Try to make percona work? + #mysqld --no-defaults --initialize-insecure --datadir=/tmp/mysql_test + #mysqld --no-defaults --datadir=/tmp/mysql_test --secure-file-priv=/tmp/mysql_test --socket=/tmp/socket.mysql --bind-address=127.0.0.1 --skip-grant-tables & + + mysql_install_db --datadir=/tmp/mysql_test + mysqld --datadir=/tmp/mysql_test --socket=/tmp/socket.mysql --skip-grant-tables & + MYSQL_PID=$! + sleep 5 + mysql -h 127.0.0.1 -u root -e "create database IF NOT EXISTS test;" + mysql -h 127.0.0.1 -u root -e "create database IF NOT EXISTS persistent;" + + # Compatibility issue with mariadb: https://github.com/yesodweb/persistent/issues/1158 + TRAVIS=true runhaskell Setup test || echo "Tests failed" + + kill $MYSQL_PID +} + +package() { + cd $_hkgname-$pkgver + + install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh + install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh + runhaskell Setup copy --destdir="$pkgdir" + install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/ + rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE +}