changeset 81:d963a085e93f

use _ROOT and _PREFIX iso DIR. Fix DESTDIR install into system/usr/usr, fix broken_install_command installing sysconf in system/usr/etc
author janneke <janneke@gnu.org>
date Thu, 01 Dec 2005 08:35:31 +0100
parents 644f5f882311
children 85bcf949d16a
files driver.py specs/darwintools.py specs/framework.py specs/gub.py specs/mingw.py
diffstat 5 files changed, 87 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/driver.py	Thu Dec 01 08:30:09 2005 +0100
+++ b/driver.py	Thu Dec 01 08:35:31 2005 +0100
@@ -29,28 +29,17 @@
 		self.builddir = self.targetdir + '/build'
 		self.garbagedir = self.targetdir + '/garbage'
 		self.statusdir = self.targetdir + '/status'
-
-		## uploaddir contains .gub tarballs.
-		## maybe rename to gubpackagedir ?
+		# FIXME: rename to gubpackagedir ?
 		self.uploaddir = self.targetdir + '/uploads'
-
-		## dir for platform library & headers.
-		## FIXME: systemDIR/installDIR are unclear concepts
-		## I'd rather stick with mingw's
-		## TARGET-ROOT, TARGET-PREFIX, INSTALL-ROOT, INSTALL-PREFIX
-		self.systemdir = self.targetdir + '/system'
-
-		## dir for our own stuff, including library & headers.
-		## FIXME: currently merged with: systemdir/usr
-		## as we need one place for the target root
+		# FIXME: rename to target_root?
+		self.system_root = self.targetdir + '/system'
 		self.installdir = self.targetdir + '/install'
-
 		self.tooldir = self.targetdir + '/tools'
 
 	def create_dirs (self): 
 		for a in ('downloaddir',
 			  'garbagedir',
-			  'specdir', 'srcdir', 'statusdir', 'systemdir',
+			  'specdir', 'srcdir', 'statusdir', 'system_root',
                           'targetdir', 'topdir',
 			  'uploaddir'):
 			dir = self.__dict__[a]
@@ -65,7 +54,7 @@
 	for stage in ('untar', 'patch', 'configure', 'compile', 'install',
 		      'package', 'sysinstall'):
         	if not package.is_done (stage):
-			print 'doing stage', stage
+			print 'gub:' + package.name () + ':' + stage
                 	if stage == 'untar':
                         	package.untar ()
 			elif stage == 'patch':
--- a/specs/darwintools.py	Thu Dec 01 08:30:09 2005 +0100
+++ b/specs/darwintools.py	Thu Dec 01 08:35:31 2005 +0100
@@ -10,14 +10,14 @@
 		return 'darwin-sdk.tar.gz'
 
 	def patch (self):
-		pat = self.settings.systemdir + '/usr/lib/*.la'
+		pat = self.settings.system_root + '/usr/lib/*.la'
 		for a in glob.glob (pat):
-			self.file_sub (r' (/usr/lib/.*\.la)', '%(systemdir)s\1', a)
+			self.file_sub (r' (/usr/lib/.*\.la)', '%(system_root)s\1', a)
 
 		
 	
 class Odcctools (gub.Cross_package):
-	def installdir (self):
+	def install_prefix (self):
 		return self.settings.tooldir
 	
 class Gcc (gub.Cross_package):
--- a/specs/framework.py	Thu Dec 01 08:30:09 2005 +0100
+++ b/specs/framework.py	Thu Dec 01 08:35:31 2005 +0100
@@ -23,14 +23,14 @@
 		if self.settings.platform.startswith ('mingw'):
 			self.system ('''cd %(srcdir)s && autoconf''')
 			self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
-			self.settings.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(systemdir)s/usr/include' % self.package_dict ()
+			self.settings.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_root)s/usr/include' % self.package_dict ()
 		gub.Target_package.configure (self)
 
 	def install_command (self):
 		return gub.Target_package.install_command (self) \
 		       + gub.join_lines ('''
-INCLUDEDIR=%(installdir)s/include
-MANDIR=%(installdir)s/share/man
+INCLUDEDIR=%(install_prefix)s/include
+MANDIR=%(install_prefix)s/share/man
 ''')
 
 class Gmp (gub.Target_package):
@@ -60,9 +60,9 @@
 		if self.settings.platform.startswith ('mingw'):
 			# minimal libtool fixups
 			self.system ('''
-mkdir -p %(installdir)s/bin
-mv %(installdir)s/lib/lib*.dll %(installdir)s/bin/
-cp %(builddir)s/.libs/libgmp.dll.a %(installdir)s/lib/
+mkdir -p %(install_prefix)s/bin
+mv %(install_prefix)s/lib/lib*.dll %(install_prefix)s/bin/
+cp %(builddir)s/.libs/libgmp.dll.a %(install_prefix)s/lib/
 ''')
 
 class Guile (gub.Target_package):
@@ -106,7 +106,7 @@
 			str += '''
 guile_cv_func_usleep_declared=${guile_cv_func_usleep_declared=yes}
 guile_cv_exeext=${guile_cv_exeext=}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="%(systemdir)s/usr/lib"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="%(system_root)s/usr/lib"}
 '''
 		return str
 
@@ -137,19 +137,19 @@
 	def install (self):
 		gub.Target_package.install (self)
 		version = self.read_pipe ('''\
-GUILE_LOAD_PATH=%(installdir)s/share/guile/* %(installdir)s/bin/guile-config --version 2>&1\
+GUILE_LOAD_PATH=%(install_prefix)s/share/guile/* %(install_prefix)s/bin/guile-config --version 2>&1\
 ''').split ()[-1]
-		self.dump ('%(installdir)s/bin/%(target_architecture)s-guile-config', '''\
+		self.dump ('%(install_prefix)s/bin/%(target_architecture)s-guile-config', '''\
 #!/bin/sh
 [ "$1" == "--version" ] && echo "%(target_architecture)s-guile-config - Guile version %(version)s"
-#[ "$1" == "compile" ] && echo "-I $%(systemdir)s/usr/include"
-#[ "$1" == "link" ] && echo "-L%(systemdir)s/usr/lib -lguile -lgmp"
+#[ "$1" == "compile" ] && echo "-I $%(system_root)s/usr/include"
+#[ "$1" == "link" ] && echo "-L%(system_root)s/usr/lib -lguile -lgmp"
 prefix=$(dirname $(dirname $0))
 [ "$1" == "compile" ] && echo "-I$prefix/include"
 [ "$1" == "link" ] && echo "-L$prefix/lib -lguile -lgmp"
 exit 0
 ''')
-		os.chmod ('%(installdir)s/bin/%(target_architecture)s-guile-config' % self.package_dict (), 0755)
+		os.chmod ('%(install_prefix)s/bin/%(target_architecture)s-guile-config' % self.package_dict (), 0755)
 
 
 class LilyPond (gub.Target_package):
@@ -159,7 +159,7 @@
 
 	def configure_command (self):
 		## FIXME: pickup $target-guile-config
-		cmd = 'PATH=%(systemdir)s/usr/bin:$PATH '
+		cmd = 'PATH=%(system_root)s/usr/bin:$PATH '
 
 		cmd += gub.Target_package.configure_command (self)
 		cmd += ' --disable-documentation'
@@ -167,7 +167,7 @@
 			cmd += gub.join_lines ('''
 --without-kpathsea
 --enable-relocation
---with-python-include=%(systemdir)s/usr/include/python2.4
+--with-python-include=%(system_root)s/usr/include/python2.4
 --disable-optimising
 ''')
 		return cmd
@@ -195,7 +195,7 @@
 	def compile_command (self):
 		cmd = gub.Target_package.compile_command (self)
 		if self.settings.platform.startswith ('mingw'):
-			python_lib = "%(systemdir)s/usr/bin/libpython2.4.dll"
+			python_lib = "%(system_root)s/usr/bin/libpython2.4.dll"
 			return cmd + gub.join_lines ('''
 LDFLAGS=%(python_lib)s
 HELP2MAN_GROFFS=
@@ -223,8 +223,8 @@
 		gub.Target_package.install (self)
 		if self.settings.platform.startswith ('mingw'):
 			self.system ('''
-install -m755 %(builddir)/lily/out/lilypond %(installdir)/bin/lilypond-windows
-install -m755 %(builddir)/lily/out-console/lilypond %(installdir)/bin/lilypond
+install -m755 %(builddir)/lily/out/lilypond %(install_prefix)/bin/lilypond-windows
+install -m755 %(builddir)/lily/out-console/lilypond %(install_prefix)/bin/lilypond
 ''')
 
 class Gettext (gub.Target_package):
@@ -332,8 +332,8 @@
 		cmd = gub.Target_package.configure_command (self) \
 		      + gub.join_lines ('''
 --with-freetype-config="/usr/bin/freetype-config
---prefix=%(systemdir)s/usr
---exec-prefix=%(systemdir)s/usr
+--prefix=%(system_root)s/usr
+--exec-prefix=%(system_root)s/usr
 "''')
 
 		if self.settings.platform.startswith ('mingw'):
@@ -350,8 +350,8 @@
 		rm -f %(srcdir)s/builds/unix/{unix-def.mk,unix-cc.mk,ftconfig.h,freetype-config,freetype2.pc,config.status,config.log}
 ''',
 			     env = {'ft_config' : '''/usr/bin/freetype-config \
---prefix=%(installdir)s \
---exec-prefix=%(installdir)s \
+--prefix=%(install_prefix)s \
+--exec-prefix=%(install_prefix)s \
 '''})
 		gub.Target_package.configure (self)
 		if self.settings.platform.startswith ('mingw'):
@@ -386,10 +386,10 @@
 		       + gub.join_lines ('''
 EXEEXT=
 RUN_FC_CACHE_TEST=false
-exec_prefix=%(installdir)s
-libdir=%(installdir)s/lib
-includedir=%(installdir)s/include
-man1dir=%(installdir)s/share/man/man1
+exec_prefix=%(install_prefix)s
+libdir=%(install_prefix)s/lib
+includedir=%(install_prefix)s/include
+man1dir=%(install_prefix)s/share/man/man1
 ''')
 
 class Zlib (gub.Target_package):
--- a/specs/gub.py	Thu Dec 01 08:30:09 2005 +0100
+++ b/specs/gub.py	Thu Dec 01 08:35:31 2005 +0100
@@ -92,7 +92,7 @@
 			'build_architecture': self.settings.build_architecture,
 			'garbagedir': self.settings.garbagedir,
 			'gtk_version': self.settings.gtk_version,
-			'systemdir': self.settings.systemdir,
+			'system_root': self.settings.system_root,
 			'target_architecture': self.settings.target_architecture,
 			'tool_prefix': self.settings.tool_prefix,
 			'target_gcc_flags': self.settings.target_gcc_flags,
@@ -103,7 +103,8 @@
 			'compile_command': self.compile_command (),
 			'configure_command': self.configure_command (),
 			'install_command': self.install_command (),
-			'installdir': self.installdir (),
+			'install_root': self.install_root (),
+			'install_prefix': self.install_prefix (),
 			'srcdir': self.srcdir (),
 			'sourcesdir': self.settings.srcdir,
 			'uploaddir': self.settings.uploaddir,
@@ -175,8 +176,11 @@
 	def builddir (self):
 		return self.settings.builddir + '/' + self.basename ()
 
-	def installdir (self):
-		return self.settings.installdir + '/' + self.name ()
+	def install_root (self):
+		return self.settings.installdir + "/" + self.name () + '-root'
+
+	def install_prefix (self):
+		return self.install_root () + '/usr'
 
 	def file_name (self):
 		if self.url:
@@ -226,7 +230,7 @@
 ''', locals ())
 
 	def configure_command (self):
-		return '%(srcdir)s/configure --prefix=%(installdir)s'
+		return '%(srcdir)s/configure --prefix=%(install_prefix)s'
 
 	def configure (self):
 		self.system ('''
@@ -244,7 +248,7 @@
 
 	def libtool_la_fixups (self):
 		dll_name = 'lib'
-		for i in glob.glob ('%(installdir)s/lib/*.la' \
+		for i in glob.glob ('%(install_prefix)s/lib/*.la' \
 				    % self.package_dict ()):
 			base = os.path.basename (i)[3:-3]
 			self.file_sub (''' *-L *[^"' ][^"' ]*''', '', i)
@@ -308,7 +312,7 @@
 	def configure_command (self):
 		cmd = Package.configure_command (self)
 		cmd += ''' --target=%(target_architecture)s
---with-sysroot=%(systemdir)s'''
+--with-sysroot=%(system_root)s/usr'''
 		return join_lines (cmd)
 	
 class Target_package (Package):
@@ -329,35 +333,29 @@
 	def config_cache_overrides (self, str):
 		return str
 
-	def installdir (self):
-		# FIXME: the usr/ works around a fascist check in libtool
-		# better use %(installdir)s/USR throughout and remove here?
-		return self.settings.installdir + "/" + self.name () + "-root/usr"
-		# FIXME: system dir vs packaging install
-		# no packages for now
-		# return self.settings.systemdir + '/usr'
-
 	def broken_install_command (self):
 		"For packages that don't honor DESTDIR."
-		
+
+		# FIXME: use sysconfdir=%(install_PREFIX)s/etc?  If
+		# so, must also ./configure that way
 		return join_lines ('''make install
-bindir=%(installdir)s/bin
-aclocaldir=%(installdir)s/share/aclocal
-datadir=%(installdir)s/share
-exec_prefix=%(installdir)s
-gcc_tooldir=%(installdir)s
-includedir=%(installdir)s/include
-infodir=%(installdir)s/share/info
-libdir=%(installdir)s/lib
-libexecdir=%(installdir)s/lib
-mandir=%(installdir)s/share/man
-prefpix=%(installdir)s
-sysconfdir=%(installdir)s/etc
-tooldir=%(installdir)s
+bindir=%(install_prefix)s/bin
+aclocaldir=%(install_prefix)s/share/aclocal
+datadir=%(install_prefix)s/share
+exec_prefix=%(install_prefix)s
+gcc_tooldir=%(install_prefix)s
+includedir=%(install_prefix)s/include
+infodir=%(install_prefix)s/share/info
+libdir=%(install_prefix)s/lib
+libexecdir=%(install_prefix)s/lib
+mandir=%(install_prefix)s/share/man
+prefpix=%(install_prefix)s
+sysconfdir=%(install_root)s/etc
+tooldir=%(install_prefix)s
 ''')
 
 	def install_command (self):
-		return join_lines ('''make DESTDIR=%(installdir)s install''')
+		return join_lines ('''make DESTDIR=%(install_root)s install''')
 
 	def config_cache (self):
 		self.system ('mkdir -p %(builddir)s')
@@ -377,33 +375,33 @@
 	def package (self):
 		# naive tarball packages for now
 		self.system ('''
-tar -C %(installdir)s -zcf %(uploaddir)s/%(name)s.gub .
+tar -C %(install_prefix)s -zcf %(uploaddir)s/%(name)s.gub .
 ''')
 
 	def sysinstall (self):
 		self.system ('''
-mkdir -p %(systemdir)s/usr
-tar -C %(systemdir)s/usr -zxf %(uploaddir)s/%(name)s.gub
+mkdir -p %(system_root)s/usr
+tar -C %(system_root)s/usr -zxf %(uploaddir)s/%(name)s.gub
 ''')
 
 	def target_dict (self, env={}):
 		dict = {
 			'AR': '%(tool_prefix)sar',
 			'CC': '%(tool_prefix)sgcc %(target_gcc_flags)s',
-			'CPPFLAGS': '-I%(systemdir)s/usr/include',
+			'CPPFLAGS': '-I%(system_root)s/usr/include',
 			'CXX':'%(tool_prefix)sg++ %(target_gcc_flags)s',
 			'DLLTOOL' : '%(tool_prefix)sdlltool',
 			'DLLWRAP' : '%(tool_prefix)sdllwrap',
 			'LD': '%(tool_prefix)sld',
-#			'LDFLAGS': '-L%(systemdir)s/usr/lib',
+#			'LDFLAGS': '-L%(system_root)s/usr/lib',
 # FIXME: for zlib, try adding bin
-			'LDFLAGS': '-L%(systemdir)s/usr/lib -L%(systemdir)s/usr/bin',
+			'LDFLAGS': '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin',
 			'NM': '%(tool_prefix)snm',
-			'PKG_CONFIG_PATH': '%(systemdir)s/usr/lib/pkgconfig',
+			'PKG_CONFIG_PATH': '%(system_root)s/usr/lib/pkgconfig',
 			'PKG_CONFIG': '''/usr/bin/pkg-config \
---define-variable prefix=%(systemdir)s/usr \
---define-variable includedir=%(systemdir)s/usr/include \
---define-variable libdir=%(systemdir)s/usr/lib \
+--define-variable prefix=%(system_root)s/usr \
+--define-variable includedir=%(system_root)s/usr/include \
+--define-variable libdir=%(system_root)s/usr/lib \
 ''',
 			'RANLIB': '%(tool_prefix)sranlib',
 			'SED': 'sed', # libtool (expat mingw) fixup
@@ -438,6 +436,8 @@
 class Binary_package (Package):
 	def untar (self):
 		self.system ("rm -rf  %(srcdir)s %(builddir)s")
+		# FIXME: /root is typically holds ./bin, ./lib, include,
+		# so is typically not _ROOT, but _PREFIX
 		self.system ('mkdir -p %(srcdir)s/root')
 		tarball = self.settings.downloaddir + '/' + self.file_name ()
 		if not os.path.exists (tarball):
@@ -456,5 +456,8 @@
 		pass
 
 	def install (self):
-		self.system ('mkdir -p %(installdir)s')
-		self.system ('tar -C %(srcdir)s/root -cf- . | tar -C %(installdir)s -xvf-')
+		# FIXME: .GUB packaging only in TARGET_PACKAGE, skipping
+		# installing in install_root, use expensive direct
+		# make install %(system_root)s/usr
+		self.system ('mkdir -p %(system_root)s/usr')
+		self.system ('tar -C %(srcdir)s/root -cf- . | tar -C %(system_root)s/usr -xvf-')
--- a/specs/mingw.py	Thu Dec 01 08:30:09 2005 +0100
+++ b/specs/mingw.py	Thu Dec 01 08:35:31 2005 +0100
@@ -38,7 +38,6 @@
 		self.system ('cd %(srcdir)s && mv root/gs-%(version)s/* .')
 
 	def patch (self):
-		installroot = os.path.dirname (self.installdir ())
 		gs_prefix = '/usr/share/gs'
 		self.dump ('%(srcdir)s/configure', '''
 cat > Makefile <<EOF
@@ -46,14 +45,14 @@
 	@echo done
 all: default
 install:
-	mkdir -p %(installdir)s
-	tar -C %(srcdir)s -cf- bin | tar -C %(installdir)s -xvf-
-	mkdir -p %(installroot)s/%(gs_prefix)s
-	tar -C %(srcdir)s -cf- fonts lib Resource | tar -C %(installroot)s/%(gs_prefix)s -xvf-
-	fc-cache %(installroot)s/%(gs_prefix)s/fonts
-	mkdir -p %(installdir)s/share/doc/gs/html
-	tar -C %(srcdir)s/doc -cf- --exclude='[A-Z]*[A-Z]' . | tar -C %(installdir)s/share/doc/gs/html -xvf-
-	tar -C %(srcdir)s/doc -cf- --exclude='*.htm*' . | tar -C %(installdir)s/share/doc/gs/html -xvf-
+	mkdir -p %(install_prefix)s
+	tar -C %(srcdir)s -cf- bin | tar -C %(install_prefix)s -xvf-
+	mkdir -p %(install_root)s/%(gs_prefix)s
+	tar -C %(srcdir)s -cf- fonts lib Resource | tar -C %(install_root)s/%(gs_prefix)s -xvf-
+	fc-cache %(install_root)s/%(gs_prefix)s/fonts
+	mkdir -p %(install_prefix)s/share/doc/gs/html
+	tar -C %(srcdir)s/doc -cf- --exclude='[A-Z]*[A-Z]' . | tar -C %(install_prefix)s/share/doc/gs/html -xvf-
+	tar -C %(srcdir)s/doc -cf- --exclude='*.htm*' . | tar -C %(install_prefix)s/share/doc/gs/html -xvf-
 EOF
 ''', env=locals ())
 		os.chmod ('%(srcdir)s/configure' % self.package_dict (), 0755)
@@ -65,7 +64,7 @@
 		return gub.join_lines ('''
 ALL_OBJS='$(OBJS)'
 WRC=/usr/bin/wrc
-CPPFLAGS=-I%(systemdir)s/usr/include
+CPPFLAGS=-I%(system_root)s/usr/include
 RC='$(WRC) $(CPPFLAGS)'
 LIBWINE=
 LIBPORT=