Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Created December 6, 2012 23:19
Show Gist options
  • Save kentfredric/4229359 to your computer and use it in GitHub Desktop.
Save kentfredric/4229359 to your computer and use it in GitHub Desktop.
# Maintainer: Kent Fredric <kentnl@cpan.org>
# Previous Maintainer: yugrotavele <yugrotavele at archlinux dot us>
_perl_distname=Acme-Damn
_perl_author=IBB
_perl_version=0.05
pkgdesc="'Unbless' Perl objects"
depends=('perl')
checkdepends=('perl-test-exception' 'perl-test-simple')
pkgname=perl-acme-damn
url="https://metacpan.org/release/$_perl_distname"
license=('PerlArtistic' 'GPL')
source=(
"http://cpan.metacpan.org/authors/id/I/IB/IBB/${_perl_distname}-${_perl_version}.tar.gz"
"perlmod.sh"
)
pkgver=0.05
pkgrel=3
arch=('i686' 'x86_64')
options=(!emptydirs)
sha1sums=('5eb4bb27642ed12d8219362cf9027694d631ef3c'
'1bfeb36289429b784c461d02c2ab0cd690c0ca8c')
_bm() {
_dir=$(find $srcdir -maxdepth 2 -type f -name 'Makefile.PL')
if [ ! -z "$_dir" ]; then
echo "EUMM";
return 0;
fi
_dir=$(find $srcdir -maxdepth 2 -type f -name 'Build.PL')
if [ ! -z "$_dir" ]; then
echo "MB";
return 0;
fi
error "failed to detect build method for $pkgname";
error "you may be able to fix this by editing the PKGBUILD"
exit 1;
}
_bdir() {
_dir=$(find $srcdir -maxdepth 2 -type f -name $1 );
dirname "$_dir";
}
build() {
_build_method=$(_bm);
if [ $_build_method = 'EUMM' ]; then
cd $(_bdir Makefile.PL);
PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1
make || return 1
else if [ $_build_method = 'MB' ]; then
cd $(_bdir Build.PL);
PERL_MM_USE_DEFAULT=1 perl Build.PL INSTALLDIRS=vendor || return 1
./Build || return 1
fi fi
}
check() {
_build_method=$(_bm);
if [ $_build_method = 'EUMM' ]; then
cd $(_bdir Makefile.PL);
make test || return 1
else if [ $_build_method = 'MB' ]; then
cd $(_bdir Build.PL);
./Build test || return 1
fi fi
}
package() {
_build_method=$(_bm);
if [ $_build_method = 'EUMM' ]; then
cd $(_bdir Makefile.PL);
make install DESTDIR="${pkgdir}" || return 1
else if [ $_build_method = 'MB' ]; then
cd $(_bdir Build.PL);
./Build install destdir=${pkgdir} || return 1
fi fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment