Reorganize the tree for easier and better handling.
- Template helpers have been moved to templates/helpers. - Documentation to docs/. - Common scripts have been moved to utils/sh. - Fixed install-destdir when executed via chroot. - Added a build-pkg target that builds a binary package. The package must be installed into destdir before using. - Misc tweaks and fixes. --HG-- extra : convert_revision : 0896e8f24bb7592116aaf77ae9c776033818a3d8
This commit is contained in:
18
templates/helpers/automake.sh
Normal file
18
templates/helpers/automake.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# This helper runs the GNU autoconf tools and friends for a template.
|
||||
# Optionally $automake_dir may be specified for a specific directory.
|
||||
#
|
||||
|
||||
run_automake()
|
||||
{
|
||||
$XBPS_MASTERDIR/bin/aclocal
|
||||
$XBPS_MASTERDIR/bin/libtoolize --automake
|
||||
$XBPS_MASTERDIR/bin/automake -a --foreign -i
|
||||
$XBPS_MASTERDIR/bin/autoconf
|
||||
}
|
||||
|
||||
if [ -z "$automake_dir" ]; then
|
||||
cd $wrksrc && run_automake
|
||||
else
|
||||
cd $wrksrc/$automake_dir && run_automake
|
||||
fi
|
9
templates/helpers/fontconfig-update.sh
Normal file
9
templates/helpers/fontconfig-update.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# This helpers runs fc-cache after fontconfig has been installed,
|
||||
# and update its list of fonts.
|
||||
#
|
||||
|
||||
if [ -x $XBPS_MASTERDIR/bin/fc-cache ]; then
|
||||
$XBPS_MASTERDIR/bin/fc-cache -f
|
||||
[ "$?" -eq 0 ] && echo "=> Updated fontconfig fonts cache."
|
||||
fi
|
17
templates/helpers/gtk-update-gdkpixbufloaders.sh
Normal file
17
templates/helpers/gtk-update-gdkpixbufloaders.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# This helper updates GTK's gdk-pixbug.loaders modules file every time
|
||||
# a template requests this process.
|
||||
#
|
||||
gtk_version="2.0"
|
||||
gdk_pixbuf_query_cmd=$XBPS_MASTERDIR/bin/gdk-pixbuf-query-loaders
|
||||
gdk_pixbuf_db=$XBPS_SYSCONFDIR/gtk-$gtk_version/gdk-pixbuf.loaders
|
||||
|
||||
if [ -x $gdk_pixbuf_query_cmd -a -w $gdk_pixbuf_db ]; then
|
||||
$gdk_pixbuf_query_cmd > $gdk_pixbuf_db
|
||||
[ "$?" -eq 0 ] && \
|
||||
echo "=> Updated GTK+ $(basename $gdk_pixbuf_db) modules file."
|
||||
fi
|
||||
|
||||
unset gtk_version
|
||||
unset gdk_pixbuf_query_cmd
|
||||
unset gdk_pixbuf_dbfile
|
14
templates/helpers/gtk-update-icon-cache.sh
Normal file
14
templates/helpers/gtk-update-icon-cache.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# This helper updates the GTK's theme icon cache as requested by
|
||||
# any template.
|
||||
#
|
||||
|
||||
gtkupdate_iconcache_cmd=$XBPS_MASTERDIR/bin/gtk-update-icon-cache
|
||||
iconcache_theme_dir=$XBPS_MASTERDIR/share/icons/hicolor
|
||||
|
||||
if [ -x $gtkupdate_iconcache_cmd -a -d $iconcache_theme_dir ]; then
|
||||
$gtkupdate_iconcache_cmd -f -t $iconcache_theme_dir && \
|
||||
echo "=> Updated GTK's hicolor icon cache theme."
|
||||
fi
|
||||
|
||||
unset gtkupdate_iconcache_cmd iconcache_theme_dir
|
17
templates/helpers/gtk-update-immodules.sh
Normal file
17
templates/helpers/gtk-update-immodules.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# This helper updates GTK's gtk.immodules modules file every time
|
||||
# a template requests this process.
|
||||
#
|
||||
gtk_version="2.0"
|
||||
gtk_query_immodules_cmd=$XBPS_MASTERDIR/bin/gtk-query-immodules-$gtk_version
|
||||
gtk_immodules_db=$XBPS_SYSCONFDIR/gtk-$gtk_version/gtk.immodules
|
||||
|
||||
if [ -x $gtk_query_immodules_cmd -a -w $gtk_immodules_db ]; then
|
||||
$gtk_query_immodules_cmd > $gtk_immodules_db
|
||||
[ "$?" -eq 0 ] && \
|
||||
echo "=> Updated GTK+ $(basename $gtk_immodules_db) modules file."
|
||||
fi
|
||||
|
||||
unset gtk_version
|
||||
unset gtk_query_immodules_cmd
|
||||
unset gtk_immodules_db
|
25
templates/helpers/mkfontxx-rebuild.sh
Normal file
25
templates/helpers/mkfontxx-rebuild.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# This helper rebuilds the fonts.dir and fonts.scale files in a
|
||||
# directory specified by a template.
|
||||
#
|
||||
|
||||
[ -z "$fonts_dir" ] && return 1
|
||||
[ ! -d "$fonts_dir" ] && $mkdir_cmd -p $fonts_dir
|
||||
|
||||
mkfontdir_cmd=$XBPS_MASTERDIR/bin/mkfontdir
|
||||
mkfontscale_cmd=$XBPS_MASTERDIR/bin/mkfontscale
|
||||
|
||||
if [ -x $mkfontdir_cmd -a -x $mkfontscale_cmd ]; then
|
||||
save_path=$(pwd -P 2>/dev/null)
|
||||
cd $fonts_dir && $mkfontdir_cmd && $mkfontscale_cmd
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "=> Updated $fonts_dir/fonts.dir."
|
||||
echo "=> Updated $fonts_dir/fonts.scale."
|
||||
fi
|
||||
cd $save_path
|
||||
unset save_path
|
||||
fi
|
||||
|
||||
unset fonts_dir
|
||||
unset mkfontdir_cmd
|
||||
unset mkfontscale_cmd
|
16
templates/helpers/pango-update-modules.sh
Normal file
16
templates/helpers/pango-update-modules.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This helper updates the pango modules file when the pango package
|
||||
# has been properly installed and stowned.
|
||||
#
|
||||
|
||||
pango_query_modules_cmd=$XBPS_MASTERDIR/bin/pango-querymodules
|
||||
pango_query_modules_db=$XBPS_SYSCONFDIR/pango/pango.modules
|
||||
|
||||
if [ -x $pango_query_modules_cmd -a -w $pango_query_modules_db ]; then
|
||||
$pango_query_modules_cmd > $pango_query_modules_db
|
||||
[ "$?" -eq 0 ] && \
|
||||
echo "=> Updated Pango's $pango_query_modules_db modules file."
|
||||
fi
|
||||
|
||||
unset pango_query_modules_cmd
|
||||
unset pango_query_modules_db
|
93
templates/helpers/perl-module.sh
Normal file
93
templates/helpers/perl-module.sh
Normal file
@@ -0,0 +1,93 @@
|
||||
#
|
||||
# This helper does the required steps to be able to build and install
|
||||
# perl modules into the correct location.
|
||||
#
|
||||
# Required vars to be set by a template:
|
||||
#
|
||||
# build_style=perl_module
|
||||
#
|
||||
# Optionally if the module needs more directories to be configured other
|
||||
# than $XBPS_BUILDDIR/$wrksrc, one can use (relative to $wrksrc):
|
||||
#
|
||||
# perl_configure_dirs=blob/bob foo/blah
|
||||
#
|
||||
|
||||
# Override the paths to get desired results.
|
||||
: ${_arch:=$(uname -m)}
|
||||
: ${perl_thrmulti:=${_arch}-netbsd-thread-multi}
|
||||
: ${perl_cmd:=$XBPS_MASTERDIR/bin/perl}
|
||||
: ${PERL_DESTDIR:=$XBPS_MASTERDIR}
|
||||
: ${PERL_PREFIX:=$PERL_DESTDIR}
|
||||
: ${PERL_DPREFIX:=$XBPS_DESTDIR/$pkgname-$version}
|
||||
: ${PERL_VERSION:=5.10.0}
|
||||
: ${PERL_LDDLFLAGS:=--whole-archive -shared -L$XBPS_MASTERDIR/lib}
|
||||
: ${PERL_SITELIBEXP:=$PERL_DPREFIX/lib/perl5/site_perl/$PERL_VERSION}
|
||||
: ${PERL_SITEARCHEXP:=$PERL_SITELIBEXP/$perl_thrmulti}
|
||||
: ${PERL_SITEPREFIX:=$PERL_PREFIX}
|
||||
: ${PERL_INSTALLPRIVLIB:=$PERL_DPREFIX/lib/perl5/$PERL_VERSION}
|
||||
: ${PERL_INSTALLSITELIB:=$PERL_DPREFIX/lib/perl5/site_perl/$PERL_VERSION}
|
||||
: ${PERL_INSTALLARCHLIB:=$PERL_DPREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti}
|
||||
: ${PERL_INSTALLSITEARCH:=$PERL_SITELIBEXP}
|
||||
: ${PERL_INSTALLBIN:=$PERL_DPREFIX/bin}
|
||||
: ${PERL_INSTALLSITEBIN:=$PERL_INSTALLBIN}
|
||||
: ${PERL_INSTALLSCRIPT:=$PERL_DPREFIX/bin}
|
||||
: ${PERL_INSTALLSITESCRIPT:=$PERL_INSTALLSCRIPT}
|
||||
: ${PERL_INSTALLMAN1DIR:=$PERL_DPREFIX/man/man1}
|
||||
: ${PERL_INSTALLSITEMAN1DIR=$PERL_INSTALLMAN1DIR}
|
||||
: ${PERL_INSTALLMAN3DIR:=$PERL_DPREFIX/man/man3}
|
||||
: ${PERL_INSTALLSITEMAN3DIR:=$PERL_INSTALLMAN3DIR}
|
||||
: ${PERL_PERLLIB:=$PERL_PREFIX/lib/perl5/$PERL_VERSION}
|
||||
: ${PERL_ARCHLIB:=$PERL_PREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti}
|
||||
: ${PERL_INC:=$PERL_PREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti/CORE}
|
||||
|
||||
: ${PERL_MAKE_VARS:=LDFLAGS=$LDFLAGS LDDLFLAGS=$PERL_LDDLFLAGS \
|
||||
SITELIBEXP=$PERL_SITELIBEXP SITEARCHEXP=$PERL_SITEARCHEXP \
|
||||
PERLPREFIX=$PERL_DESTDIR SITEPREFIX=$PERL_SITEPREFIX \
|
||||
INSTALLPRIVLIB=$PERL_INSTALLPRIVLIB \
|
||||
INSTALLSITELIB=$PERL_INSTALLSITELIB \
|
||||
INSTALLARCHLIB=$PERL_INSTALLARCHLIB \
|
||||
INSTALLSITEARCH=$PERL_INSTALLSITEARCH \
|
||||
INSTALLBIN=$PERL_INSTALLBIN \
|
||||
INSTALLSITEBIN=$PERL_INSTALLSITEBIN \
|
||||
INSTALLSCRIPT=$PERL_INSTALLSCRIPT \
|
||||
INSTALLSITESCRIPT=$PERL_INSTALLSITESCRIPT \
|
||||
INSTALLMAN1DIR=$PERL_INSTALLMAN1DIR \
|
||||
INSTALLSITEMAN1DIR=$PERL_INSTALLSITEMAN1DIR \
|
||||
INSTALLMAN3DIR=$PERL_INSTALLMAN3DIR \
|
||||
INSTALLSITEMAN3DIR=$PERL_INSTALLSITEMAN3DIR \
|
||||
PERL_LIB=$PERL_PERLLIB PERL_ARCHLIB=$PERL_ARCHLIB}
|
||||
|
||||
perl_module_build()
|
||||
{
|
||||
local builddir="$wrksrc"
|
||||
local perlmkf=
|
||||
|
||||
if [ -z "$perl_configure_dirs" ]; then
|
||||
perlmkf="$builddir/Makefile.PL"
|
||||
if [ ! -f $perlmkf ]; then
|
||||
echo "*** ERROR couldn't find $perlmkf, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $builddir && \
|
||||
$perl_cmd Makefile.PL ${PERL_MAKE_VARS} $make_build_args
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "*** ERROR building perl module for $pkgname ***"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for i in "$perl_configure_dirs"; do
|
||||
perlmkf="$builddir/$i/Makefile.PL"
|
||||
if [ -f $perlmkf ]; then
|
||||
cd $builddir/$i && \
|
||||
$perl_cmd Makefile.PL \
|
||||
${PERL_MAKE_VARS} $make_build_args
|
||||
[ "$?" -ne 0 ] && exit 1
|
||||
else
|
||||
echo -n "*** ERROR: couldn't find $perlmkf"
|
||||
echo ", aborting ***"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
46
templates/helpers/replace-interpreter.sh
Normal file
46
templates/helpers/replace-interpreter.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# This helper replaces shebang paths pointing to the correct ones
|
||||
# as used by xbps. Multiple languages are supported:
|
||||
#
|
||||
# - GNU Bash
|
||||
# - Perl
|
||||
# - Python
|
||||
#
|
||||
|
||||
bash_regexp=".*sh"
|
||||
perl_regexp=".*perl[^[:space:]]*"
|
||||
python_regexp=".*python[^[:space:]]*"
|
||||
|
||||
replace_interpreter()
|
||||
{
|
||||
local lang="$1"
|
||||
local file="$2"
|
||||
local trsb=
|
||||
local orsb=
|
||||
|
||||
[ -z $lang -o -z $file ] && return 1
|
||||
|
||||
case $lang in
|
||||
bash)
|
||||
orsb=$bash_regexp
|
||||
trpath="/bin/bash"
|
||||
;;
|
||||
perl)
|
||||
orsb=$perl_regexp
|
||||
trpath="/usr/bin/perl"
|
||||
;;
|
||||
python)
|
||||
orsb=$python_regexp
|
||||
trpath="/usr/bin/python"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f $file ]; then
|
||||
sed -i -e "1s|^#![[:space:]]*${orsb}|#!${trpath}|" $file && \
|
||||
msg_normal "Transformed $lang script: ${file##$wrksrc}."
|
||||
else
|
||||
msg_warn "Ignoring unexistent $lang script: ${file##$wrksrc}."
|
||||
fi
|
||||
}
|
14
templates/helpers/update-desktopdb.sh
Normal file
14
templates/helpers/update-desktopdb.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# This helper update's desktop-file-utils desktop database for any
|
||||
# package that requests this operation.
|
||||
#
|
||||
|
||||
update_desktopdb_cmd=$XBPS_MASTERDIR/bin/update-desktop-database
|
||||
desktopdb_dir=$XBPS_MASTERDIR/share/applications
|
||||
|
||||
if [ -x $update_desktopdb_cmd -a -d $desktopdb_dir ]; then
|
||||
$update_desktopdb_cmd $desktopdb_dir && \
|
||||
echo "=> Updated desktop database directory."
|
||||
fi
|
||||
|
||||
unset update_desktopdb_cmd desktopdb_dir
|
13
templates/helpers/update-mimedb.sh
Normal file
13
templates/helpers/update-mimedb.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# This helper updates shared-mime-info's database when a template
|
||||
# requests this operation.
|
||||
#
|
||||
updatemimedb_cmd="$XBPS_MASTERDIR/bin/update-mime-database"
|
||||
updatemimedb_dir="$XBPS_MASTERDIR/share/mime"
|
||||
|
||||
if [ -d "$XBPS_MASTERDIR/share/mime" ]; then
|
||||
$updatemimedb_cmd $updatemimedb_dir >/dev/null && \
|
||||
echo "=> Updated shared-mime-info database."
|
||||
fi
|
||||
|
||||
unset updatemimedb_cmd updatemimedb_dir
|
30
templates/helpers/xml-catalogs.sh
Normal file
30
templates/helpers/xml-catalogs.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# This helper registers DTDs and XML/SGML catalogs through the
|
||||
# xmlcatmgr application, as done in pkgsrc.
|
||||
#
|
||||
|
||||
xmlcatmgr_cmd=$XBPS_MASTERDIR/bin/xmlcatmgr
|
||||
sgml_catalog=$XBPS_MASTERDIR/share/sgml/catalog
|
||||
xml_catalog=$XBPS_MASTERDIR/share/xml/catalog
|
||||
|
||||
if [ -x $xmlcatmgr_cmd -a -f $sgml_catalog -a -f $xml_catalog ]; then
|
||||
if [ -n "$sgml_entries" ]; then
|
||||
echo "=> Registering SGML catalogs for \`$pkgname-$version'."
|
||||
set -- ${sgml_entries}
|
||||
while [ $# -gt 0 ]; do
|
||||
$xmlcatmgr_cmd -sc $sgml_catalog add "$1" "$2" "$3"
|
||||
shift; shift; shift;
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$xml_entries" ]; then
|
||||
echo "=> Registering XML catalogs for \`$pkgname-$version'."
|
||||
set -- ${xml_entries}
|
||||
while [ $# -gt 0 ]; do
|
||||
$xmlcatmgr_cmd -c $xml_catalog add "$1" "$2" "$3"
|
||||
shift; shift; shift;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
unset xmlcatmgr_cmd sgml_catalog xml_catalog
|
Reference in New Issue
Block a user