From a9fed27639c9414002b01fd7f40f9b8b19f8b2a7 Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Sun, 27 Jan 2013 13:39:22 +0100 Subject: [PATCH] Extend gnu symlink functionality This makes the gnu symlink functionality an integrated part of the install function. The interface is now the variable gnu_link_progs which when defined triggers the automatic symlinking. --- buildpkg.functions | 29 ++++++++++++++++++++++------- buildpkg.packaging.solaris | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/buildpkg.functions b/buildpkg.functions index c455628..ad46600 100644 --- a/buildpkg.functions +++ b/buildpkg.functions @@ -144,6 +144,12 @@ maketest=0 # When patching use -p1 as default prefix patch_prefix="-p1" +# Settings for gnu_link +# GNU prefix +gnu_prefix=g +# GNU dir +_gnudir=gnu + # Distfiles should be named like this # --.sb--- # ie: libmad-0.14.2b-1.sb-sol5.8-sparcv9-local @@ -755,20 +761,22 @@ check_changelog() fi } -# setup_gnu_link: Setup links in $prefix/gnu/bin +# gnu_link: Setup links in $prefix/$_gnudir # params: list of programs to link -# For each program given, create a symlink from $prefix/bin/program to -# $prefix/gnu/bin with the first character stripped from the name -setup_gnu_link() +# For each program given, create a symlink from $prefix/${_bindir}/program to +# $prefix/gnu with the first character stripped from the name +gnu_link() { local program - ${__mkdir} -p ${stagedir}${prefix}/gnu/bin - setdir ${stagedir}${prefix}/gnu/bin + ${__mkdir} -p ${stagedir}${prefix}/$_gnudir + setdir ${stagedir}${prefix}/$_gnudir for program in $@ do - ${__ln_s} ../../bin/$program ${program:1} + local dest=${program:1} + echo "Linking $prefix/${_bindir}/$program to $prefix/$_gnudir/$dest" + ${__ln_s} ../${_bindir}/$program ${program:1} done } @@ -926,6 +934,13 @@ generic_install() if [ $autonuke -eq 1 ]; then do_autonuke fi + if [ -n "$gnu_link_progs" ]; then + # There are programs that should be linked to $prefix/$_gnudir + local prog + for prog in $gnu_link_progs; do + gnu_link ${gnu_prefix}${prog} + done + fi } # generic_install_perl(): Install already built perl module diff --git a/buildpkg.packaging.solaris b/buildpkg.packaging.solaris index 023a977..73ce9e3 100644 --- a/buildpkg.packaging.solaris +++ b/buildpkg.packaging.solaris @@ -80,7 +80,7 @@ _mandir=share/man _infodir=share/info # Default configure args -configure_args='--prefix=$prefix --mandir=${prefix}/${_mandir} --infodir=${prefix}/${_infodir}' +configure_args='${gnu_link_progs:+--program-prefix=$gnu_prefix} --prefix=$prefix --mandir=${prefix}/${_mandir} --infodir=${prefix}/${_infodir}' # Host specific configuration [ -r $buildpkgscripts/config.`hostname`.solaris ] && . $buildpkgscripts/config.`hostname`.solaris