208 lines
4.6 KiB
Bash
Executable file
208 lines
4.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# $NetBSD: url2pkg,v 1.25 2003/07/25 09:25:00 cjep Exp $
|
|
#
|
|
# url2pkg
|
|
# (c) 1999-2002 Hubert Feyrer <hubert@feyrer.de>
|
|
#
|
|
|
|
if [ "$MAKE" = "" ]; then
|
|
MAKE=@MAKE@
|
|
fi
|
|
|
|
if [ "$PKGEDITOR" != "" ]; then
|
|
editor="$PKGEDITOR"
|
|
elif [ "$EDITOR" != "" ]; then
|
|
editor="$EDITOR"
|
|
else
|
|
editor="vi"
|
|
fi
|
|
|
|
if [ "$PKGMAINTAINER" != "" ]; then
|
|
email_maintainer="$PKGMAINTAINER"
|
|
elif [ "$REPLYTO" != "" ]; then
|
|
email_maintainer="$REPLYTO"
|
|
else
|
|
email_maintainer="INSERT_YOUR_MAIL_ADDRESS_HERE"
|
|
fi
|
|
|
|
if [ ! -f ../../mk/bsd.pkg.mk ]; then
|
|
echo "Run this in .../pkgsrc/foo/bar !"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f w*/.extract_done ]; then
|
|
if [ "$1" = "" ]; then
|
|
echo -n 'URL: '
|
|
read url
|
|
else
|
|
url="$1"
|
|
fi
|
|
|
|
sourceforge="http://prdownloads.sourceforge.net/"
|
|
if [ `expr "$url" : "$sourceforge.*"` -gt 0 ]; then
|
|
DISTNAME=`expr "$url" : '.*/\([^/?]*\)'`
|
|
sfname=`expr "$url" : "${sourceforge}\(.*\)/[^/]*\$"`
|
|
MASTER_SITES='${MASTER_SITE_SOURCEFORGE:='"$sfname"'/}'
|
|
HOMEPAGE="http://$sfname.sourceforge.net/"
|
|
else
|
|
DISTNAME=`expr "$url" : '.*/\([^/]*\)$'`
|
|
MASTER_SITES=`expr "$url" : '\(.*/\)[^/]*$'`
|
|
HOMEPAGE=$MASTER_SITES
|
|
fi
|
|
|
|
case "$DISTNAME" in
|
|
*.tgz) EXTRACT_SUFX=".tgz"
|
|
DISTNAME=`expr ${DISTNAME} : '\(.*\)\.[^.]*'`
|
|
;;
|
|
*.tar.Z) EXTRACT_SUFX=.tar.Z
|
|
DISTNAME=`expr ${DISTNAME} : '\(.*\)\.[^.]*\.[^.]*'`
|
|
;;
|
|
*.tar.gz) EXTRACT_SUFX=.tar.gz
|
|
DISTNAME=`expr ${DISTNAME} : '\(.*\)\.[^.]*\.[^.]*'`
|
|
;;
|
|
*.tar.bz2) EXTRACT_SUFX=.tar.bz2
|
|
DISTNAME=`expr ${DISTNAME} : '\(.*\)\.[^.]*\.[^.]*'`
|
|
;;
|
|
*) EXTRACT_SUFX=`expr ${DISTNAME} : '.*\(\.[^.]*\)'`
|
|
DISTNAME=`expr ${DISTNAME} : '\(.*\)\.[^.]*'`
|
|
;;
|
|
esac
|
|
|
|
if [ -f Makefile ]; then
|
|
mv Makefile Makefile.BAK
|
|
fi
|
|
|
|
category=`pwd | sed 's|^.*/\([^/]*\)/[^/]*$|\1|'`
|
|
(
|
|
echo '# $'NetBSD'$'
|
|
echo '#'
|
|
echo ""
|
|
echo "DISTNAME= $DISTNAME"
|
|
echo "CATEGORIES= $category"
|
|
echo "MASTER_SITES= $MASTER_SITES"
|
|
if [ "$EXTRACT_SUFX" != ".tar.gz" ]; then
|
|
echo "EXTRACT_SUFX= ${EXTRACT_SUFX}"
|
|
fi
|
|
echo ""
|
|
echo "MAINTAINER= $email_maintainer"
|
|
echo "HOMEPAGE= $HOMEPAGE"
|
|
echo "COMMENT= SHORT_DESCRIPTION_OF_THE_PACKAGE"
|
|
echo ""
|
|
echo '.include "../../mk/bsd.pkg.mk"'
|
|
) >Makefile
|
|
|
|
echo '@comment $'NetBSD'$' > PLIST
|
|
touch distinfo
|
|
|
|
${editor} +5 Makefile
|
|
|
|
echo "Running 'make makesum' ..."
|
|
$MAKE makesum
|
|
|
|
echo "Running 'make extract' ..."
|
|
$MAKE extract
|
|
fi
|
|
|
|
#
|
|
# Exec Artificial Intelligence Modules here ...
|
|
#
|
|
wrksrc=`cd w* ; echo *`
|
|
if [ "$wrksrc" != "$DISTNAME" ]; then
|
|
WRKSRC="\${WRKDIR}/$wrksrc"
|
|
fi
|
|
|
|
wsrcdir=`echo w*`/$wrksrc
|
|
configure=$wsrcdir/configure
|
|
echo checking $configure XXX
|
|
if [ -x $configure ]; then
|
|
if $configure --version | egrep \
|
|
'configure generated by autoconf version|Free Software Foundation' \
|
|
>/dev/null 2>&1 ; then
|
|
GNU_CONFIGURE=yes
|
|
else
|
|
HAS_CONFIGURE=yes
|
|
fi
|
|
|
|
if find $wsrcdir -name \*.mo -o -name \*.gmo >/dev/null ; then
|
|
USE_PKGLOCALEDIR=yes
|
|
fi
|
|
|
|
GCONF2_SCHEMAS=`find $wsrcdir -name \*.schemas -o -name \*.schemas.in* \
|
|
| sed -e 's|^.*/||' -e 's/.in.in$//' -e 's/.in$//'`
|
|
fi
|
|
|
|
ltconfig=$wsrcdir/ltconfig
|
|
ltmain=$wsrcdir/ltmain.sh
|
|
libtool=\${WRKSRC}/libtool
|
|
echo checking libtool: $ltconfig
|
|
if [ -f $ltconfig -o -f $ltmain ]; then
|
|
USE_LIBTOOL=yes
|
|
LIBTOOL_OVERRIDE=${libtool}
|
|
fi
|
|
|
|
PKGCONFIGS=`cd $wsrcdir && find * -name \*.pc.in -a ! -name \*-uninstalled.pc.in -type f`
|
|
|
|
echo "Fixing up Makefile."
|
|
(
|
|
sed '/^.include/d' <Makefile
|
|
|
|
if [ "${WRKSRC}" != "" ]; then
|
|
echo "WRKSRC= $WRKSRC"
|
|
fi
|
|
|
|
echo "USE_BUILDLINK2= yes"
|
|
|
|
if [ "${USE_PKGLOCALEDIR}" != "" ]; then
|
|
echo "USE_PKGLOCALEDIR= $USE_PKGLOCALEDIR"
|
|
fi
|
|
|
|
if [ "${USE_LIBTOOL}" != "" ]; then
|
|
echo "USE_LIBTOOL= $USE_LIBTOOL"
|
|
fi
|
|
if [ "${LIBTOOL_OVERRIDE}" != "" ]; then
|
|
echo "LIBTOOL_OVERRIDE= $LIBTOOL_OVERRIDE"
|
|
fi
|
|
|
|
for i in $PKGCONFIGS ; do
|
|
echo "PKGCONFIG_OVERRIDE+= \${WRKSRC}/$i"
|
|
done
|
|
|
|
if [ "${HAS_CONFIGURE}" != "" ]; then
|
|
echo "HAS_CONFIGURE= $HAS_CONFIGURE"
|
|
fi
|
|
if [ "${GNU_CONFIGURE}" != "" ]; then
|
|
echo "GNU_CONFIGURE= $GNU_CONFIGURE"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
if [ -n "$GCONF2_SCHEMAS" ]; then
|
|
echo 'CONFIGURE_ENV+= GCONF_SCHEMA_FILE_DIR="${PREFIX}/share/gconf/schemas/"'
|
|
echo 'MAKE_ENV+= GCONF_SCHEMA_FILE_DIR="${PREFIX}/share/gconf/schemas/"'
|
|
|
|
echo ""
|
|
|
|
for i in $GCONF2_SCHEMAS ; do
|
|
echo "GCONF2_SCHEMAS+= $i"
|
|
done
|
|
|
|
echo ""
|
|
echo '.include "../../devel/GConf2/schemas.mk"'
|
|
fi
|
|
|
|
echo '.include "../../mk/bsd.pkg.mk"'
|
|
) >Makefile.$$
|
|
mv Makefile.$$ Makefile
|
|
|
|
echo ""
|
|
echo "Contents of $wsrcdir:"
|
|
ls -la $wsrcdir
|
|
|
|
if [ ! -f DESCR ]; then
|
|
touch DESCR
|
|
fi
|
|
echo ""
|
|
echo "Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!"
|
|
echo ""
|
|
echo "Good luck! (See pkgsrc/Packages.txt for some more help :-)"
|