- move all RPM build code into a script instead of the makefile. This is

an improvement because you have to do a configure before using any makefile.
  It used to be "configure; make rpm" and now it's just
  "./build/redhat/make-rpm".
This commit is contained in:
Bryce Denney 2001-12-08 15:59:50 +00:00
parent ff74c51296
commit 761a5c16a3
3 changed files with 89 additions and 33 deletions

View File

@ -48,21 +48,15 @@ CAT=cat
RM=rm
MV=mv
LN_S=ln -sf
RPMSPEC=build/redhat/bochs.rpmspec.template
DLXLINUX_TAR=dlxlinux2.tar.gz
DLXLINUX_TAR_URL=http://bochs.sourceforge.net/guestos/$(DLXLINUX_TAR)
DLXLINUX_ROMFILE=BIOS-bochs-latest
GUNZIP=gunzip
WGET=wget
SED=sed
SOURCES=/usr/src/redhat/SOURCES
SPECS=/usr/src/redhat/SPECS
RPMS=/usr/src/redhat/RPMS
SRPMS=/usr/src/redhat/SRPMS
MKDIR=mkdir
RMDIR=rmdir
TAR=tar
RPM=rpm
CHMOD=chmod
GZIP=gzip
GUNZIP=gunzip
@ -192,7 +186,7 @@ $(BX_OBJS): $(BX_INCLUDES)
bxversion.h:
$(RM) -f bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' > bxversion.h
echo '// $$Id: Makefile.in,v 1.60 2001-12-08 05:35:57 bdenney Exp $$' >> bxversion.h
echo '// $$Id: Makefile.in,v 1.61 2001-12-08 15:59:50 bdenney Exp $$' >> bxversion.h
echo '/////////////////////////////////////////////////////////////////////////' >> bxversion.h
echo '// This file is generated by "make bxversion.h"' >> bxversion.h
echo "#define VER_STRING \"$(VER_STRING)\"" >> bxversion.h
@ -346,26 +340,6 @@ uninstall::
for i in bochs bximage bochs-dlx $(BOCHS_SCRIPTS); do rm -f $(DESTDIR)$(bindir)/$$i; done
for i in $(MAN_PAGE_LIST); do $(RM) -f $(man1dir)/$$i.1; done
################################################################
# Building an RPM on Linux
#
# This must be done as root on a linux box.
# The command is:
# sh .conf.linux; make rpm
# The binary rpm will appear in /usr/src/redhat/RPMS/i386/bochs-nnnnn.i386.rpm
# The source rpm will be in /usr/src/redhat/SRPMS/bochs-nnnnn.src.rpm
################################################################
rpm:: dist-clean download_dlx
test -w $(SOURCES)
test -w $(SPECS)
rm -f /usr/src/redhat/SPECS/bochs.spec
$(CAT) $(RPMSPEC) | $(SED) "s/@SEDVERSION@/$(VERSION)/g" > $(SPECS)/bochs.spec
$(RM) -rf $(SOURCES)/bochs
$(MKDIR) $(SOURCES)/bochs
$(TAR) cf - * .??* | (cd $(SOURCES)/bochs && tar xf -)
(cd $(SOURCES); tar czf bochs.tar.gz bochs)
$(RPM) -ba $(SPECS)/bochs.spec
V6WORKSPACE_ZIP=build/win32/workspace.zip
V6WORKSPACE_FILES=bochs.dsw bochs.dsp bochs.opt cpu/cpu.dsp \
memory/memory.dsp iodev/iodev.dsp instrument/stubs/stubs.dsp \

View File

@ -6,7 +6,7 @@ License: LGPL
Group: Applications/Emulators
URL:http://bochs.sourceforge.net
Packager:Bryce Denney <bryce.denney@bigfoot.com>
Source:bochs.tar.gz
Source:bochs-@SEDVERSION@.tar.gz
BuildRoot: /var/tmp/%{name}-buildroot
%description
@ -15,13 +15,13 @@ the x86 CPU, related AT hardware, and BIOS to run DOS, Windows '95, Minix 2.0,
and other OS's, all on your workstation.
%prep
rm -rf $RPM_BUILD_DIR/bochs
tar xzvf $RPM_SOURCE_DIR/bochs.tar.gz
rm -rf $RPM_BUILD_DIR/bochs-@SEDVERSION@
tar xzvf $RPM_SOURCE_DIR/bochs-@SEDVERSION@.tar.gz
if test "/" != $RPM_BUILD_ROOT; then
rm -rf $RPM_BUILD_ROOT
fi
%build
cd $RPM_BUILD_DIR/bochs
cd $RPM_BUILD_DIR/bochs-@SEDVERSION@
CONFIGURE_ARGS="--prefix /usr"
export CONFIGURE_ARGS
sh .conf.linux
@ -30,7 +30,7 @@ and other OS's, all on your workstation.
# the paths in dlx bochsrc file.
%install
pwd
cd $RPM_BUILD_DIR/bochs
cd $RPM_BUILD_DIR/bochs-@SEDVERSION@
for i in "" usr usr/bin usr/man usr/man/man1; do
if ! test -d $RPM_BUILD_ROOT/$i; then mkdir $RPM_BUILD_ROOT/$i; fi
done
@ -50,7 +50,7 @@ and other OS's, all on your workstation.
/usr/bochs/latest
/usr/man/man1/*
%clean
rm -rf $RPM_BUILD_DIR/bochs
rm -rf $RPM_BUILD_DIR/bochs-@SEDVERSION@
if test "/" != $RPM_BUILD_ROOT; then
rm -rf $RPM_BUILD_ROOT
fi

82
bochs/build/redhat/make-rpm Executable file
View File

@ -0,0 +1,82 @@
#!/bin/bash -x
#########################################################################
# $Id: make-rpm,v 1.1 2001-12-08 15:59:50 bdenney Exp $
#########################################################################
# build/redhat/make-rpm
#
# This script creates an RPM from the bochs directory. You must run
# it as root from the top of the source directory (where the configure
# scripts are). Then just run:
# ./build/redhat/make-rpm
#
#########################################################################
CAT=cat
RM=rm
MKDIR=mkdir
GREP=grep
ECHO=echo
RPM=rpm
SED=sed
TAR=tar
RPMSRCPATH=/usr/src/redhat
SOURCES=${RPMSRCPATH}/SOURCES
SPECS=${RPMSRCPATH}/SPECS
RPMS=${RPMSRCPATH}/RPMS
SRPMS=${RPMSRCPATH}/SRPMS
RPMSPEC="build/redhat/bochs.rpmspec.template"
echo Reading version from configure.in script.
VERSION='unknown'
eval `${GREP} '^VERSION="' configure.in`
if test $? != 0 -o "$VERSION" = unknown; then
echo Could not get version number from configure.in script.
echo Exiting.
exit 1
fi
# test that you are able to write in the RPM build area
if test ! -w ${SOURCES}; then
echo ${SOURCES} not writable. Maybe you aren\'t root, or the path is wrong.
echo Exiting.
exit 1
fi
if test ! -w ${SPECS}; then
echo ${SPECS} not writable. Maybe you aren\'t root, or the path is wrong.
exit 1
fi
# copy the spec into SPECS. The template is in $RPMSPEC, and we use
# SED to substitute in the version number.
${RM} -f /usr/src/redhat/SPECS/bochs.spec
test $? = 0 || exit 1
${CAT} ${RPMSPEC} | ${SED} "s/@SEDVERSION@/${VERSION}/g" > ${SPECS}/bochs.spec
test $? = 0 || exit 1
# make a TAR.GZ of the entire source directory, exactly as it is. The
# tar is placed in $SOURCES/bochs-$VERSION.tar.gz. Because the current
# directory could be named nearly anything, I copy all the contents into
# $SOURCES/bochs-$VERSION and then build a tar in $SOURCES.
${RM} -rf ${SOURCES}/bochs-${VERSION}
test $? = 0 || exit 1
${MKDIR} ${SOURCES}/bochs-${VERSION}
test $? = 0 || exit 1
${TAR} cf - * .??* | (cd ${SOURCES}/bochs-${VERSION} && tar xf -)
test $? = 0 || exit 1
(cd ${SOURCES}; tar czf bochs-${VERSION}.tar.gz bochs-${VERSION})
test $? = 0 || exit 1
${RM} -rf ${SOURCES}/bochs-${VERSION}
test $? = 0 || exit 1
# finally, start the rpm build.
${RPM} -ba ${SPECS}/bochs.spec
# print final status
if test $? = 0; then
echo RPM build succeeded
exit 0
else
echo RPM build failed.
exit 1
fi