diff options
author | markd <markd@pkgsrc.org> | 2016-01-24 19:34:44 +0000 |
---|---|---|
committer | markd <markd@pkgsrc.org> | 2016-01-24 19:34:44 +0000 |
commit | 4231a973f600617ebf75a202857ebbdc214aca35 (patch) | |
tree | 07b7c1cbae11be5127f872048aa55fb5b63d2e09 /pkgtools | |
parent | ae9e9b7aa51a4f58c983a5d3cd092a606d056c1f (diff) | |
download | pkgsrc-4231a973f600617ebf75a202857ebbdc214aca35.tar.gz |
Add texlive2pkg 1.0
Tool to automate initial steps in building a texlive package
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/texlive2pkg/DESCR | 3 | ||||
-rw-r--r-- | pkgtools/texlive2pkg/Makefile | 39 | ||||
-rw-r--r-- | pkgtools/texlive2pkg/PLIST | 5 | ||||
-rwxr-xr-x | pkgtools/texlive2pkg/files/texlive.pkg | 88 | ||||
-rwxr-xr-x | pkgtools/texlive2pkg/files/texlive.pkg.doc | 66 | ||||
-rw-r--r-- | pkgtools/texlive2pkg/files/texlive2pkg.8 | 81 | ||||
-rwxr-xr-x | pkgtools/texlive2pkg/files/texlive2pkg.sh | 91 |
7 files changed, 373 insertions, 0 deletions
diff --git a/pkgtools/texlive2pkg/DESCR b/pkgtools/texlive2pkg/DESCR new file mode 100644 index 00000000000..b40977377d9 --- /dev/null +++ b/pkgtools/texlive2pkg/DESCR @@ -0,0 +1,3 @@ +The texlive2pkg program creates a new pkgsrc package for the +corresponding texlive package. It is intended to help pkgsrc +developers create new texlive packages quickly and easily. diff --git a/pkgtools/texlive2pkg/Makefile b/pkgtools/texlive2pkg/Makefile new file mode 100644 index 00000000000..def8870c1c1 --- /dev/null +++ b/pkgtools/texlive2pkg/Makefile @@ -0,0 +1,39 @@ +# $NetBSD: Makefile,v 1.1 2016/01/24 19:34:44 markd Exp $ +# + +PKGNAME= texlive2pkg-1.0 +CATEGORIES= pkgtools + +MAINTAINER= markd@NetBSD.org +HOMEPAGE= # none +COMMENT= Tool to automate initial steps in building a texlive package +LICENSE= modified-bsd + +WRKSRC= ${WRKDIR} +NO_BUILD= yes +USE_LANGUAGES= # none +USE_TOOLS+= perl:run xzcat:run +AUTO_MKDIRS= yes + +SUBST_CLASSES+= tools +SUBST_STAGE.tools= pre-configure +SUBST_MESSAGE.tools= Substituting tool locations. +SUBST_FILES.tools= texlive2pkg.sh +SUBST_VARS.tools= DISTDIR MAKE PREFIX + +REPLACE_PERL+= texlive.pkg texlive.pkg.doc + +INSTALLATION_DIRS+= bin libexec/texlive2pkg ${PKGMANDIR}/man8 + +do-extract: + ${CP} ${FILESDIR}/texlive2pkg.sh ${WRKSRC} + ${CP} ${FILESDIR}/texlive2pkg.8 ${WRKSRC} + ${CP} ${FILESDIR}/texlive.pkg* ${WRKSRC} + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/texlive2pkg.sh ${DESTDIR}${PREFIX}/bin/texlive2pkg + ${INSTALL_SCRIPT} ${WRKSRC}/texlive.pkg ${DESTDIR}${PREFIX}/libexec/texlive2pkg/texlive.pkg + ${INSTALL_SCRIPT} ${WRKSRC}/texlive.pkg.doc ${DESTDIR}${PREFIX}/libexec/texlive2pkg/texlive.pkg.doc + ${INSTALL_MAN} ${WRKSRC}/texlive2pkg.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8/texlive2pkg.8 + +.include "../../mk/bsd.pkg.mk" diff --git a/pkgtools/texlive2pkg/PLIST b/pkgtools/texlive2pkg/PLIST new file mode 100644 index 00000000000..bcc164aef57 --- /dev/null +++ b/pkgtools/texlive2pkg/PLIST @@ -0,0 +1,5 @@ +@comment $NetBSD: PLIST,v 1.1 2016/01/24 19:34:44 markd Exp $ +bin/texlive2pkg +libexec/texlive2pkg/texlive.pkg +libexec/texlive2pkg/texlive.pkg.doc +man/man8/texlive2pkg.8 diff --git a/pkgtools/texlive2pkg/files/texlive.pkg b/pkgtools/texlive2pkg/files/texlive.pkg new file mode 100755 index 00000000000..4636e6cc5b5 --- /dev/null +++ b/pkgtools/texlive2pkg/files/texlive.pkg @@ -0,0 +1,88 @@ +#!/usr/pkg/bin/perl +# $NetBSD: texlive.pkg,v 1.1 2016/01/24 19:34:44 markd Exp $ + +$version = "2015"; +$pkgname = $shortdesc = $revision = $license = $longdesc = $depend = $homepage = ""; +$plist = $other = $maps = ""; + +while (<>) { + $pkgname = $1,next if (/^name (\S+)/); + $shortdesc = $1,next if (/^shortdesc +(.+)/); + $revision = $1,next if (/^revision (\S+)/); + $license = $1,next if (/^catalogue-license (\S+)/); + $version = $1,next if (/^catalogue-version +(.+)/); + $homepage = $1,next if (/^catalogue +(.+)/); + next if (/^category /); + next if (/^catalogue-also /); + next if (/^catalogue-ctan /); + next if (/^catalogue-date /); + next if (/^catalogue-topics /); + next if (/^relocated /); + next if (/^runfiles /); + $longdesc .= "$1\n",next if (/^longdesc (.+)/); + $depend .= "DEPENDS+=\ttex-$1-[0-9]*:../../print/tex-$1\n",next if (/^depend (.+)/); + $maps .= "TEX_MAP_FILES+=\t$1\n",next if (/^execute addMap (.+)/); + $maps .= "TEX_MIXEDMAP_FILES+=\t$1\n",next if (/^execute addMixedMap (.+)/); + + $plist .= "share/texmf-dist$1\n", next if (/^ RELOC(.+)/); + $plist .= "share/$1\n",next if (/^ (.+)/); + + $other .= "# " . $_; +} + +$shortdesc =~ s/\.$//; +$version =~ s:/::g; +$version =~ s: :_:g; # 5th edition +$version =~ s:-::g; # 2013-05-12 +$license = "apache-2.0" if ($license eq "apache2"); +$license = "gnu-fdl-v1.3" if ($license eq "fdl"); +$license = "gnu-gpl-v2" if ($license eq "gpl"); +$license = "gnu-gpl-v2" if ($license eq "gpl2"); +$license = "gnu-gpl-v3" if ($license eq "gpl3"); +$license = "lppl-1.2" if ($license eq "lppl1.2"); +$license = "lppl-1.3c" if ($license eq "lppl"); +$license = "lppl-1.3c" if ($license eq "lppl1.3"); +$license = "modified-bsd" if ($license eq "bsd"); +$license = "ofl-v1.1" if ($license eq "ofl"); +$license = "public-domain" if ($license eq "pd"); + +$extras = ""; +$extras .= "\n$depend" if ($depend); +$extras .= "\n$maps" if ($maps); +$extras .= "\n$other" if ($other); + +$homepage = $pkgname if ($homepage eq ""); + +mkdir "tex-$pkgname"; + +open(DESCR, ">tex-$pkgname/DESCR"); +print DESCR "$longdesc"; +close(DESCR); + +open(PLIST, ">tex-$pkgname/PLIST"); +print PLIST "\@comment \$NetBSD\$\n"; +print PLIST "$plist"; +close(PLIST); + +open(MAKE, ">tex-$pkgname/Makefile"); + +print MAKE <<OUT; +# \$NetBSD\$ + +DISTNAME= $pkgname +PKGNAME= tex-\${DISTNAME}-$version +TEXLIVE_REV= $revision + +MAINTAINER= pkgsrc-users\@NetBSD.org +HOMEPAGE= http://ctan.org/pkg/$homepage +COMMENT= $shortdesc +LICENSE= $license +$extras +.include "../../print/texlive/package.mk" +.include "../../mk/bsd.pkg.mk" +OUT + +close(MAKE); + +print STDERR "$pkgname $version rev $revision ($license) $shortdesc $homepage \n\n"; +print "PKG=$pkgname VERSION=$version REV=$revision LICENSE=\"$license\" HOMEPAGE=$homepage\n"; diff --git a/pkgtools/texlive2pkg/files/texlive.pkg.doc b/pkgtools/texlive2pkg/files/texlive.pkg.doc new file mode 100755 index 00000000000..673374d0270 --- /dev/null +++ b/pkgtools/texlive2pkg/files/texlive.pkg.doc @@ -0,0 +1,66 @@ +#!/usr/pkg/bin/perl +# $NetBSD: texlive.pkg.doc,v 1.1 2016/01/24 19:34:44 markd Exp $ + +$pkgname = $ARGV[0]; +$revision= $ARGV[1]; +$version = $ARGV[2]; +$license = $ARGV[3]; +$homepage = $ARGV[4]; +$pkgdocname = $shortdesc = $revdoc = $longdesc = $depend = ""; +$plist = $other = $maps = ""; + +while (<STDIN>) { + $pkgdocname = $1,next if (/^name (\S+)/); + $shortdesc = $1,next if (/^shortdesc +(.+)/); + $revdoc = $1,next if (/^revision (\S+)/); + $license = $1,next if (/^catalogue-license (\S+)/); + $version = $1,next if (/^catalogue-version +(.+)/); + next if (/^category /); + next if (/^catalogue-ctan /); + next if (/^catalogue-date /); + next if (/^relocated /); + next if (/^runfiles /); + next if (/^docfiles /); + next if (/^longdesc /); + + $plist .= "share/texmf-dist$1\n", next if (/^ RELOC(.+)/); + $plist .= "share/$1\n",next if (/^ (.+)/); + + $other .= "# " . $_; +} + +die "pkgname doesn't match" if ($pkgname . ".doc" ne $pkgdocname); +die "revision doesn't match" if ($revision ne $revdoc); + +mkdir "tex-${pkgname}-doc"; + +open(DESCR, ">tex-${pkgname}-doc/DESCR"); +print DESCR "Documentation for tex-${pkgname}.\n"; +close(DESCR); + +open(PLIST, ">tex-${pkgname}-doc/PLIST"); +print PLIST "\@comment \$NetBSD\$\n"; +print PLIST "$plist"; +close(PLIST); + +open(MAKE, ">tex-${pkgname}-doc/Makefile"); + +print MAKE <<OUT; +# \$NetBSD\$ + +DISTNAME= ${pkgname}.doc +PKGNAME= tex-\${DISTNAME:S/./-/}-$version +TEXLIVE_REV= $revision + +MAINTAINER= pkgsrc-users\@NetBSD.org +HOMEPAGE= http://ctan.org/pkg/$homepage +COMMENT= Documentation for tex-${pkgname} +LICENSE= $license + +.include "../../print/texlive/package.mk" +.include "../../mk/bsd.pkg.mk" +OUT + +close(MAKE); + +exit 0; diff --git a/pkgtools/texlive2pkg/files/texlive2pkg.8 b/pkgtools/texlive2pkg/files/texlive2pkg.8 new file mode 100644 index 00000000000..4f0453f5402 --- /dev/null +++ b/pkgtools/texlive2pkg/files/texlive2pkg.8 @@ -0,0 +1,81 @@ +.\" $NetBSD: texlive2pkg.8,v 1.1 2016/01/24 19:34:44 markd Exp $ +.\" +.\" Copyright (c) 2016 +.\" Mark Davies. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the author nor the names of any contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd January 24, 2016 +.Dt texlive2pkg 8 +.Os +.Sh NAME +.Nm texlive2pkg +.Nd create a pkgsrc package for a texlive package +.Sh SYNOPSIS +.Nm +.Ar package-tarball +.Op Ar doc-tarball +.Sh DESCRIPTION +.Nm +takes a texlive +.Ar package-tarball +and optional +.Ar doc-tarball +that should be turned into +.Xr pkgsrc 7 +packages under the current directory. The generated packages include a +.Pa Makefile +and a mostly complete set of files to get the package going. However, the files should be reviewed and perhaps adjusted manually after +.Nm +has finished its job. +.Pp +.Nm +is intended to help the process of creating a package but is not +intended to fly on autopilot. +.Sh EXAMPLES +Use the following commands to create a +.Xr pkgsrc 7 +package for the texlive package +.Ar foo : +.Dl cd pkgsrc/print +.Dl texlive2pkg foo.tar.xz foo.doc.tar.xz +Remember to test the resulting package. +.Sh BUGS +.Nm +does not create a finished package; instead, it facilitates the task. +However, the resulting files must be reviewed and possibly edited by +hand. Although dependencies are included in the generated +.Pa Makefile , +they are only comments; no attempt is made to find corresponding +packages within +.Xr pkgsrc 7 . +As a consequence, the category of dependencies is also not determined. +.Sh SEE ALSO +.Xr pkgsrc 7 +.Sh AUTHORS +.Nm +was written by +.An Mark Davies Aq Mt markd@NetBSD.org . diff --git a/pkgtools/texlive2pkg/files/texlive2pkg.sh b/pkgtools/texlive2pkg/files/texlive2pkg.sh new file mode 100755 index 00000000000..7cd8a947f1f --- /dev/null +++ b/pkgtools/texlive2pkg/files/texlive2pkg.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# texlive2pkg +# $NetBSD: texlive2pkg.sh,v 1.1 2016/01/24 19:34:44 markd Exp $ +# +# Copyright (c) 2016 +# Mark Davies. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the author nor the names of any contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# +# Create a texlive package in the current directory + +NAME=texlive2pkg +TDIR=/tmp/tl.$$ +DISTDIR=@DISTDIR@ +LIBEXECDIR=@PREFIX@/libexec/texlive2pkg +MAKE=@MAKE@ +pkgtarball="" +doctarball="" + +USAGE="${NAME} package-tarball [doc-tarball] -- create a texlive package for pkgsrc" + +if [ ${#} -eq 1 ]; then + pkgtarball=$1 +elif [ ${#} -eq 2 ]; then + pkgtarball=$1 + doctarball=$2 + case $doctarball in + /*.doc.tar.xz) + break ;; + *.doc.tar.xz) + doctarball=$PWD/$doctarball + break ;; + *) + echo ${USAGE} + exit 1 + esac +else + echo ${USAGE} + exit 1 +fi + +case $pkgtarball in +/*.tar.xz) + break ;; +*.tar.xz) + pkgtarball=$PWD/$pkgtarball + break ;; +*) + echo ${USAGE} + exit 1 +esac + +if [ ! -f $pkgtarball ]; then + echo "File not found - $pkgtarball" + exit 1 +fi + +(mkdir $TDIR; cd $TDIR ; xzcat $pkgtarball | tar xf - tlpkg) +eval `$LIBEXECDIR/texlive.pkg $TDIR/tlpkg/tlpobj/*.tlpobj` +mkdir -p $DISTDIR/tex-$PKG-$REV +cp $* $DISTDIR/tex-$PKG-$REV/ +(cd tex-$PKG; $MAKE makesum) +if [ -f "$doctarball" ]; then + (cd $TDIR; xzcat $doctarball | tar xf - tlpkg) + $LIBEXECDIR/texlive.pkg.doc $PKG $REV "$VERSION" "$LICENSE" "$HOMEPAGE" < $TDIR/tlpkg/tlpobj/${PKG}.doc.tlpobj && \ + (cd tex-$PKG-doc; $MAKE makesum) +fi +rm -rf $TDIR |