[pacman-dev] [PATCH v4] Add makepkg-template
Eric Bélanger
snowmaniscool at gmail.com
Mon May 6 02:21:33 EDT 2013
On Mon, May 6, 2013 at 12:50 AM, Allan McRae <allan at archlinux.org> wrote:
> On 03/05/13 04:55, Florian Pritz wrote:
> > This allows for somewhat easy templating for PKGBUILDs.
> >
> > Signed-off-by: Florian Pritz <bluewind at xinu.at>
> > ---
> >
> > v4:
> > - added support for "-" to --input and --output (stdin/stdout)
> > - adapted manpage and fixed ordering of the arguments to the example
> diff call
> > - lots of code suggestion + fixes by Andrew
>
>
>
> > + _distdir="${_distname}-${pkgver}"
> > + url="https://metacpan.org/release/${_distname}"
> > +
> > + build() {
> > + export PERL_MM_USE_DEFAULT=1 PERL5LIB="" \
> > + PERL_AUTOINSTALL=--skipdeps \
> > + PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
> > + PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
>
> Do you really require $pkgdir to be used during build... Not a great
> practise given who know what it is set to in split-packages (well, I
> know... but the point stands!)
>
>
The $pkgdir are not required here. I did that change for all the perl
packages in the repos. Just add a DESTDIR="$pkgdir" in the make install
line and you're all set. Setting these other variables are also not
necessary. The vendor install dir can go in in perl line:
build() {
cd Log-Log4perl-$pkgver
perl Makefile.PL INSTALLDIRS=vendor
make
}
I am not a perl expert but I did these changes to many perl packages. They
built fine and no one complained that they were broken.
> > + MODULEBUILDRC=/dev/null
> > +
> > + cd "$srcdir/$_distdir"
> > + /usr/bin/perl Makefile.PL
>
> Why full path?
>
> > + make
> > + }
> > +
> > + check() {
> > + export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
>
I believe that export is not needed.
> > + cd "$srcdir/$_distdir"
> > + make test
> > + }
> > +
> > + package() {
> > + cd "$srcdir/$_distdir"
> > + make DESTDIR="$pkgdir" install
> > + find "$pkgdir" -name .packlist -o -name perllocal.pod
> -delete
>
The find line is not needed. This is done automatically by makepkg.
> > + }
> > + # template end;
> > +
> > +
> > +
> > +See Also
> > +--------
> > +linkman:makepkg[8], linkman:PKGBUILD[5]
> > +
> > +include::footer.txt[]
> > diff --git a/scripts/.gitignore b/scripts/.gitignore
> > index 9e403bf..26e088b 100644
> > --- a/scripts/.gitignore
> > +++ b/scripts/.gitignore
> > @@ -1,4 +1,5 @@
> > makepkg
> > +makepkg-template
> > pacman-db-upgrade
> > pacman-key
> > pacman-optimize
> > diff --git a/scripts/Makefile.am b/scripts/Makefile.am
> > index 784b180..1f3bae2 100644
> > --- a/scripts/Makefile.am
> > +++ b/scripts/Makefile.am
> > @@ -5,6 +5,7 @@ SUBDIRS = po
> >
> > bin_SCRIPTS = \
> > $(OURSCRIPTS) \
> > + makepkg-template \
> > repo-remove \
> > repo-elephant
> >
> > @@ -18,6 +19,7 @@ OURSCRIPTS = \
> >
> > EXTRA_DIST = \
> > makepkg.sh.in \
> > + makepkg-template.pl.in \
> > pacman-db-upgrade.sh.in \
> > pacman-key.sh.in \
> > pacman-optimize.sh.in \
> > @@ -54,6 +56,7 @@ edit = sed \
> > -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
> > -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
> > -e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \
> > + -e 's|@TEMPLATE_DIR[@]|$(TEMPLATE_DIR)|g' \
> > -e 's|@DEBUGSUFFIX[@]|$(DEBUGSUFFIX)|g' \
> > -e "s|@INODECMD[@]|$(INODECMD)|g" \
> > -e 's|@SIZECMD[@]|$(SIZECMD)|g' \
> > @@ -76,6 +79,14 @@ makepkg: \
> > $(srcdir)/makepkg.sh.in \
> > $(srcdir)/library/parseopts.sh
> >
> > +makepkg-template: \
> > + $(srcdir)/makepkg-template.pl.in \
> > + Makefile
> > +
> > + $(AM_V_at)$(RM) -f makepkg-template
> > + $(AM_V_GEN)$(edit) $< > $@
> > + $(AM_V_at)chmod +x,a-w $@
> > +
> > pacman-db-upgrade: \
> > $(srcdir)/pacman-db-upgrade.sh.in \
> > $(srcdir)/library/output_format.sh
> > diff --git a/scripts/makepkg-template.pl.in b/scripts/
> makepkg-template.pl.in
> > new file mode 100755
>
> I can comment on the perl. Just a query if this is written in a certain
> version of perl? Or would it be quite compatible with an older perl 5.x
> release? In not we should add an autoconf check.
>
> Allan
>
>
>
>
More information about the pacman-dev
mailing list