diff --git a/src/libbuild/autotools.py b/src/libbuild/autotools.py new file mode 100644 index 00000000..73becc0e --- /dev/null +++ b/src/libbuild/autotools.py @@ -0,0 +1,27 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os, pisiconfig + +def configure(): + os.system( './configure --prefix=/usr \ + --host=i686-pc-linux-gnu \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --datadir=/usr/share \ + --sysconfdir=/etc \ + --localstatedir=/var/lib ') + +def make(): + os.system( 'make' ) + +def install(): + install_string = 'make prefix={D}/usr \ + datadir={D}/usr/share \ + infodir={D}/usr/share/info \ + localstatedir={D}/var/lib \ + mandir={D}/usr/share/man \ + sysconfdir={D}/etc \ + install' + + os.system( install_string.replace('{D}', pisiconfig.image_dir ) ) diff --git a/src/libbuild/gnuconfig.py b/src/libbuild/gnuconfig.py new file mode 100644 index 00000000..c6d965f3 --- /dev/null +++ b/src/libbuild/gnuconfig.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os, string, re, shutil, pisiconfig +from shell import * + +def gnuconfig_findnewest(): + + locations = [ '/usr/share/gnuconfig/config.sub', '/usr/share/automake-1.8/config.sub', '/usr/share/automake-1.7/config.sub', '/usr/share/automake-1.6/config.sub', '/usr/share/automake-1.5/config.sub', '/usr/share/automake-1.4/config.sub' ] + + newer_location = {} + + for i in locations: + newer_location[i] = re.sub( '\'', '', string.split( ( cat( i ) | tr( str.rstrip ) | grep ( '^timestamp' ) | join ), '=')[1] ) + + keys = newer_location.keys() + keys.sort() + map(newer_location.get, keys ) + + return os.path.dirname( newer_location.popitem()[0] ) + +def gnuconfig_update(): + + newer_location = gnuconfig_findnewest() + + try: + shutil.copyfile( newer_location + '/config.sub', pisiconfig.build_dir + 'popt-1.7' + '/config.sub' ) + shutil.copyfile( newer_location + '/config.guess', pisiconfig.build_dir + 'popt-1.7' + '/config.guess' ) + except IOError: + print 'Hata mata...' + sys.exit() + + print 'GNU Config Update Finished...' diff --git a/src/libbuild/libbuild.py b/src/libbuild/libbuild.py new file mode 100644 index 00000000..ca71743e --- /dev/null +++ b/src/libbuild/libbuild.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +from gnuconfig import * +from libtoolize import * +from autotools import * +import pisiconfig + +if __name__ == "__main__": + os.chdir( pisiconfig.build_dir + 'popt-1.7' ) + gnuconfig_update() + libtoolize() + configure() + make() + install() diff --git a/src/libbuild/libtoolize.py b/src/libbuild/libtoolize.py new file mode 100644 index 00000000..877cf277 --- /dev/null +++ b/src/libbuild/libtoolize.py @@ -0,0 +1,8 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import os + +def libtoolize(): + os.system( 'patch -sN < /var/lib/pisi/portage-1.4.1.patch' ) + os.system( 'patch -sN < /var/lib/pisi/sed-1.4.0.patch' ) diff --git a/src/libbuild/pisiconfig.py b/src/libbuild/pisiconfig.py new file mode 100644 index 00000000..1e7bfa1a --- /dev/null +++ b/src/libbuild/pisiconfig.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- + +db_dir = "/var/db/pisi/" +archives_dir = "/var/cache/pisi/archives/" +tmp_dir = "/var/tmp/pisi/" +lib_dir = "/var/lib/pisi/" +build_dir = tmp_dir + "build/" +image_dir = tmp_dir + "image" diff --git a/src/libbuild/shell.py b/src/libbuild/shell.py new file mode 100644 index 00000000..2f33d41f --- /dev/null +++ b/src/libbuild/shell.py @@ -0,0 +1,63 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import sys, re +from itertools import izip, imap, count, ifilter, ifilterfalse + +def cat( filename ): + return file( filename ).xreadlines() + +class grep: + """keep only lines that match the regexp""" + def __init__( self,pat, flags = 0 ): + self.fun = re.compile( pat, flags ).match + def __ror__( self, input ): + return ifilter( self.fun, input ) + +class tr: + """apply arbitrary transform to each sequence element""" + def __init__( self, transform ): + self.tr = transform + def __ror__( self, input ): + return imap( self.tr, input ) + +class printto: + """print sequence elements one per line""" + def __init__( self, out = sys.stdout ): + self.out=out + def __ror__( self,input ): + for l in input: + print >> self.out, l + +printlines = printto( sys.stdout ) + +class terminator: + def __init__( self,method ): + self.process = method + def __ror__( self,input ): + return self.process( input ) + +aslist = terminator( list ) +asdict = terminator( dict ) +astuple = terminator( tuple ) +join = terminator( "".join ) +enum = terminator( enumerate ) + +class sort: + def __ror__( self,input ): + ll = list( input ) + ll.sort() + return ll +sort = sort() + +class uniq: + def __ror__( self,input ): + for i in input: + try: + if i == prev: + continue + except NameError: + pass + prev = i + yield i +uniq = uniq() diff --git a/src/libbuild/var_lib_pisi/portage-1.4.1.patch b/src/libbuild/var_lib_pisi/portage-1.4.1.patch new file mode 100644 index 00000000..a49f3332 --- /dev/null +++ b/src/libbuild/var_lib_pisi/portage-1.4.1.patch @@ -0,0 +1,74 @@ +Note that if you update this patch, please update this one as well: + + eclass/ELT-patches/portage/1.4.1 + +The file name can stay 1.4.1, as it will still apply to all versions. Only +when a new version of libtool comes out that it do not apply to, then the +name should be bumped, but the patch content should stay fairly the same. + +--- ltmain.sh Wed Apr 3 01:19:37 2002 ++++ ltmain.sh Sun May 26 19:50:52 2002 +@@ -3940,9 +3940,50 @@ + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi +- newdependency_libs="$newdependency_libs $libdir/$name" ++ # We do not want portage's install root ($D) present. Check only for ++ # this if the .la is being installed. ++ if test "$installed" = yes && test "$D"; then ++ eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` ++ else ++ mynewdependency_lib="$libdir/$name" ++ fi ++ # Do not add duplicates ++ if test "$mynewdependency_lib"; then ++ my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` ++ if test -z "$my_little_ninja_foo_1"; then ++ newdependency_libs="$newdependency_libs $mynewdependency_lib" ++ fi ++ fi ++ ;; ++ *) ++ if test "$installed" = yes; then ++ # Rather use S=WORKDIR if our version of portage supports it. ++ # This is because some ebuild (gcc) do not use $S as buildroot. ++ if test "$PWORKDIR"; then ++ S="$PWORKDIR" ++ fi ++ # We do not want portage's build root ($S) present. ++ my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"` ++ if test -n "$my_little_ninja_foo_2" && test "$S"; then ++ mynewdependency_lib="" ++ # We do not want portage's install root ($D) present. ++ my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"` ++ elif test -n "$my_little_ninja_foo_3" && test "$D"; then ++ eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` ++ else ++ mynewdependency_lib="$deplib" ++ fi ++ else ++ mynewdependency_lib="$deplib" ++ fi ++ # Do not add duplicates ++ if test "$mynewdependency_lib"; then ++ my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` ++ if test -z "$my_little_ninja_foo_4"; then ++ newdependency_libs="$newdependency_libs $mynewdependency_lib" ++ fi ++ fi + ;; +- *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" +@@ -3975,6 +4005,10 @@ + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac ++ # Do not add duplicates ++ if test "$installed" = yes && test "$D"; then ++ install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` ++ fi + $echo > $output "\ + # $outputname - a libtool library file + # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP diff --git a/src/libbuild/var_lib_pisi/sed-1.4.0.patch b/src/libbuild/var_lib_pisi/sed-1.4.0.patch new file mode 100644 index 00000000..9c51ac2d --- /dev/null +++ b/src/libbuild/var_lib_pisi/sed-1.4.0.patch @@ -0,0 +1,14 @@ +--- ltmain.sh 2003-02-13 14:54:24.000000000 +0100 ++++ ltmain.sh 2003-02-13 15:24:49.000000000 +0100 +@@ -48,6 +48,11 @@ EOF + exit 0 + fi + ++# define variables for historic ltconfig's generated by Libtool 1.3 ++test -z "$SED" && SED=sed ++test -z "$EGREP" && EGREP=egrep ++test -z "$LTCC" && LTCC=${CC-gcc} ++ + # The name of this program. + progname=`$echo "$0" | ${SED} 's%^.*/%%'` + modename="$progname" diff --git a/src/pisiconfig.py b/src/pisiconfig.py index 8fba02a6..357e1338 100644 --- a/src/pisiconfig.py +++ b/src/pisiconfig.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- +global_patches_dir = "/var/lib/pisi/" db_dir = "/var/db/pisi/" archives_dir = "/var/cache/pisi/archives/" tmp_dir = "/var/tmp/pisi/" build_dir = tmp_dir + "build/" +image_dir = tmp_dir + "image"