Re: [AD] Unix-specific distributions

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Fri, Dec 03, 1999 at 01:05:05AM +0000, George Foot wrote:
> I'm in the process of tweaking Gorka's spec file to produce RPMs
> of this, which self-compile and nuke the build tree when they've
> installed themselves.

I've done this now; it's a funny way to use RPMs, though.  The
attached patch also fixes some things I broke with the last one
(e.g. `make install').

Now when you run my script on `allegro.zip' it generates
`allegro.tar.gz' and `allegro-enduser.tar.gz', then packs those
into RPMs as well.  The names (and hence version numbers) of the
RPMs are determined by the .spec files, so `fixver' needs a
little updating (since there are two .spec files now).

These RPMs are technically binary RPMs, meaning you use `rpm
-hiv' type commands to install them and they get installed into
the correct locations on the hard disk.  However, they're source
distributions -- the post-install script unpacks the .tar.gz
file and goes ahead with the entire building process, installing
the libraries and documentation.  For the end-user version it
also deletes the build tree (/usr/local/src/allegro).

RPM gets a little confused because the only file it installed
gets deleted too, so uninstalling the packages just results in
an error message about the file.  That's not a problem really,
but we should put in a post-uninstall script that removes the
source tree for the non-end-user version, and removes the
installed files for both versions.  We don't have a `make
uninstall' though, do we?

Making RPMs requires root privileges, stupidly -- it wants to
write them into the structure in /usr/src/redhat.  There's
probably a way to change this.  For now you'll get prompted for
you root password (twice); don't type it if you don't trust the
script -- you just won't get the RPMs.

George

diff -urN allegro-3.9.28-2/makefile.in allegro-3.9.28-3/makefile.in
--- allegro-3.9.28-2/makefile.in	Fri Dec  3 00:51:08 1999
+++ allegro-3.9.28-3/makefile.in	Fri Dec  3 05:20:32 1999
@@ -232,6 +232,8 @@
 maintainer-clean: veryclean
 	rm -fv configure
 
+install: $(INSTALL_TARGETS)
+
 mini-install: install-lib
 	@echo "Your end-user version of Allegro is now installed.  You may"
 	@echo "now delete the build tree if you wish."
diff -urN allegro-3.9.28-2/misc/allegro-enduser.spec allegro-3.9.28-3/misc/allegro-enduser.spec
--- allegro-3.9.28-2/misc/allegro-enduser.spec	Thu Jan  1 01:00:00 1970
+++ allegro-3.9.28-3/misc/allegro-enduser.spec	Fri Dec  3 04:30:33 1999
@@ -0,0 +1,66 @@
+Summary:        A game programming library (end user distribution)
+Summary(es):    Una librerνa de programaciσn de juegos.
+Name:           allegro-enduser
+Version:        3.9.28
+Release:        1
+Copyright:      Gift Ware
+Packager:       George Foot <george.foot@xxxxxxxxxx>
+Group:          Development/Libraries
+Source:         allegro-enduser.tar.gz
+Buildroot:      /var/tmp/allegro-buildroot
+
+%description
+     ______   ___    ___
+    /\  _  \ /\_ \  /\_ \
+    \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
+     \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
+      \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
+       \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
+	\/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
+				       /\____/
+				       \_/__/     Version 3.9.28 (WIP)
+
+Allegro is a cross-platform library intended for use in computer games
+and other types of multimedia programming. It was initially conceived
+on the Atari ST, but that platform sadly died during childbirth. 
+After a brief stay with Borland C, it was adopted by the fantastic djgpp
+compiler, where it grew to maturity.
+
+%description -l es
+     ______   ___    ___
+    /\  _  \ /\_ \  /\_ \
+    \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
+     \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
+      \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
+       \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
+	\/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
+				       /\____/
+				       \_/__/     Version 3.9.28 (WIP)
+
+Allegro es una librerνa multi-plataforma creada para ser usada en la
+programaciσn de juegos u otro tipo de programaciσn multimedia.
+Fue concebida inicialmente en el Atari ST, pero esa plataforma muriσ
+tristemente durante su nacimiento. Tras un corto paso por Borland C, fue
+adoptada por el fantαstico compilador djgpp, donde creciσ hasta la
+madurez.
+
+%install
+mkdir -p $RPM_BUILD_ROOT/usr/local/src
+cp $RPM_SOURCE_DIR/allegro-enduser.tar.gz $RPM_BUILD_ROOT/usr/local/src/allegro-enduser.tar.gz
+
+%post
+cd /usr/local/src
+rm -rf allegro
+gunzip -cd allegro-enduser.tar.gz | tar -xf -
+rm -f allegro-enduser.tar.gz
+cd allegro
+CFLAGS="$RPM_OPT_FLAGS" ./configure --enable-shared
+make depend
+make lib
+make install
+cd ..
+rm -rf allegro
+
+%files
+/usr/local/src/allegro-enduser.tar.gz
+
diff -urN allegro-3.9.28-2/misc/allegro.spec allegro-3.9.28-3/misc/allegro.spec
--- allegro-3.9.28-2/misc/allegro.spec	Mon Nov 22 02:31:34 1999
+++ allegro-3.9.28-3/misc/allegro.spec	Fri Dec  3 04:43:46 1999
@@ -1,14 +1,13 @@
-Summary:        A game programming library.
+Summary:        A game programming library
 Summary(es):    Una librerνa de programaciσn de juegos.
 Name:           allegro
-Version:        WIP3.9.28
+Version:        3.9.28
 Release:        1
 Copyright:      Gift Ware
-Packager:       Gorka Olaizola <olsago@xxxxxxxxxx>
-Group:  Development/Libraries
-Source: all3928.zip
-Patch:  shared.libraries.patch
-Buildroot: /var/tmp/allegro-WIP3.9.28
+Packager:       George Foot <george.foot@xxxxxxxxxx>
+Group:          Development/Libraries
+Source:         allegro.tar.gz
+Buildroot:      /var/tmp/allegro-buildroot
 
 %description
      ______   ___    ___
@@ -45,32 +44,23 @@
 adoptada por el fantαstico compilador djgpp, donde creciσ hasta la
 madurez.
 
-%prep
+%install
+mkdir -p $RPM_BUILD_ROOT/usr/local/src
+cp $RPM_SOURCE_DIR/allegro.tar.gz $RPM_BUILD_ROOT/usr/local/src/allegro.tar.gz
 
+%post
+cd /usr/local/src
 rm -rf allegro
-unzip -o /usr/src/redhat/SOURCES/all3928.zip
-
-%setup -T -D -n allegro 
-sh ./fixunix.sh
-%patch -p1
-
-%build
-CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=$RPM_BUILD_ROOT/usr \
---disable-static --enable-shared --disable-ggi --disable-svgalib \
---without-x
+gunzip -cd allegro.tar.gz | tar -xf -
+rm -f allegro.tar.gz
+cd allegro
+CFLAGS="$RPM_OPT_FLAGS" ./configure --enable-shared
+make depend
 make
-
-%install
-rm -rf $RPM_BUILD_ROOT
 make install
-
-%post
-/sbin/ldconfig -v
+make install-man
+make install-info
 
 %files
-/usr/bin/*
-/usr/lib/*
-/usr/include/allegro/*
-/usr/include/allegro.h
+/usr/local/src/allegro.tar.gz
 
-%doc AUTHORS CHANGES THANKS allegro.txt faq.txt readme.lnx
diff -urN allegro-3.9.28-2/misc/mkunixdists.sh allegro-3.9.28-3/misc/mkunixdists.sh
--- allegro-3.9.28-2/misc/mkunixdists.sh	Fri Dec  3 00:51:24 1999
+++ allegro-3.9.28-3/misc/mkunixdists.sh	Fri Dec  3 05:04:40 1999
@@ -28,6 +28,9 @@
 # If we got `.zip', remove it
 basename=$(echo "$1" | sed -e 's/\.zip$//')
 
+# Extract the path to the zip file
+zippath=$(echo "$1" | sed -e 's/[^/]*$//')
+
 # Sort out `dir', adding a trailing `/' if necessary
 if [ $# -gt 1 ]; then
 	dir=$(echo "$2" | sed -e 's/\([^/]\)$/\0\//').tmp
@@ -38,17 +41,10 @@
 
 
 ################################################################
-# Helpers
+# Error reporter
 
 error() { echo "Error occured, aborting" ; exit 1 }
 
-mktargz() {
-	echo "Creating $1.tar"
-	(cd $dir && tar -cf - allegro) > $1.tar || error
-	echo "gzipping to $1.tar.gz"
-	gzip $1.tar || error
-}
-
 
 ################################################################
 # Unzip the archive and run fixunix.sh
@@ -57,28 +53,31 @@
 
 echo "Unzipping $basename.zip to $dir"
 	unzip -q $basename.zip -d $dir || error
-
-echo "Running \`fixunix.sh\'"
-	(cd $dir/allegro && . fixunix.sh) || error
+echo "Running \`fixunix.sh'"
+	(cd $dir/allegro && . fixunix.sh >/dev/null) || error
+echo
 
 ################################################################
-# Create the developers' archive
+# Make .tar.gz distributions
 
-mktargz $basename
+mktargz() {
+	echo "Creating $1.tar"
+	(cd $dir && tar -cf - allegro) > $1.tar || error
+	echo "gzipping to $1.tar.gz"
+	gzip $1.tar || error
+}
 
+# Create the developers' archive
+mktargz $basename
+echo
 
-################################################################
 # Hack'n'slash
-
 echo "Stripping to form end-user distribution"
 (cd $dir/allegro && {
 	(cd src && rm -rf beos dos win)
 	(cd obj && rm -rf beos djgpp mingw32 msvc rsxnt watcom)
 	(cd lib && rm -rf beos djgpp mingw32 msvc rsxnt watcom)
-	(cd include && {
-		rm -f be* win*
-		(cd allegro && rm -f *beos.h *dos.h *win.h *vc.h *wat.h *becfg.h *djgpp.h *mngw32.h *rsx* *scanex.h *watcom.h)
-	})
+	(cd include && rm -f bealleg.h winalleg.h)
 	(cd misc && rm -f cmplog.pl findtext.sh fixpatch.sh fixver.sh zipup.sh)
 	rm -rf demo docs examples setup tests tools wintests
 	rm -f AUTHORS CHANGES THANKS *.txt fix* indent* readme.* allegro.mft
@@ -93,7 +92,38 @@
 	}
 })
 
+# Create the end users' archive
 mktargz $basename-enduser
+echo
+
+
+################################################################
+# Create RPM distribution(s)
+#
+# I'm a little hazy on this. :)  These are binary RPMs which
+# actually contain source code that gets built, installed and
+# deleted when you install the RPM.  I hope...
+#
+# This requires you to have Red Hat's default RPM build system
+# properly set up, so we'll skip it if that's not the case.
+
+mkrpm() {
+	echo "Creating \`$1' RPM from \`$2.tar.gz'"
+	echo "Enter your root password if prompted"
+	su -c "(\
+		rm -f /usr/src/redhat/RPMS/i386/$1-*.rpm ;\
+		cp -f $2.tar.gz /usr/src/redhat/SOURCES/$1.tar.gz ;\
+		rpm -bb $dir/allegro/misc/$1.spec ;\
+		mv -f /usr/src/redhat/RPMS/i386/$1-*.rpm $zippath ;\
+		rm -f /usr/src/redhat/SOURCES/$1.tar.gz ;\
+	)"
+	echo
+}
+
+if [ -d /usr/src/redhat ]; then
+	mkrpm allegro $basename
+	mkrpm allegro-enduser $basename-enduser
+fi
 
 
 ################################################################


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/