OpenSceneGraph/Make/makerpms
Don BURNS 893dc6d65c Added Norman Vine's changes for CYGWIN builds
Added distrules and makerpms for building RPM distributions

Removed old RedHatRPM distribution build directory

Added new dist/RPM directory and placed temporary .spec files (these
are generated by Make/makerpms and are not intended for stand-alone
use, but they keep the directory warm and CVS happy)
2002-04-04 18:01:44 +00:00

201 lines
3.8 KiB
Bash

#!/bin/sh
die()
{
echo $1
exit 1
}
s_install()
{
src_DIR=$1
mode=$2
dst_DIR=$RPM_BUILD_DIR/`echo $3 | sed 's/\///'`
[ -d $dst_DIR ] || mkdir -p $dst_DIR
THISDIR=`pwd`
cd $src_DIR
for f in `ls -1`
do
if [ -f $f ]
then
install -m $mode $f $dst_DIR/$f
fi
done
cd $THISDIR
}
print_attr()
{
dst_DIR=$1
mode=$2
t_dir=$RPM_BUILD_DIR/$dst_DIR
THISDIR=`pwd`
cd $t_dir
for f in `ls -1`
do
[ -f $f ] && echo "%attr($mode, root, root) $dst_DIR/$f"
done
cd $THISDIR
}
make_targz()
{
THISDIR=`pwd`
src_dir=$1
cd $RPM_BUILD_DIR/..
tar cvf - $src_dir |\
gzip > /usr/src/redhat/SOURCES/$src_dir.tar.gz
cd $THISDIR
}
make_spec()
{
name=$1
cat <<-LEOF > $TOPDIR/dist/RPM/$name.spec
Summary: A C++ scene graph API on OpenGL for real time graphics
Name: $name
Version: $REV
Release: $REL
Copyright: LGPL
Group: Graphics
Source: $name-$REV.tar.gz
URL: http://www.openscenegraph.org
Packager: `awk -f - /etc/passwd <<-EOF
BEGIN { FS=":"}
{
if( \\$1 == "$LOGNAME" )
print \\$5
}
EOF`
%description
The Open Scene Graph is a cross-platform C++/OpenGL library for the real-time
visualization. Uses range from visual simulation, scientific modeling, virtual
reality through to games. Open Scene Graph employs good practices in software
engineering through the use of standard C++, STL and generic programming, and
design patterns. Open Scene Graph strives for high performance and quality in
graphics rendering, protability, and extensibility
%prep
%setup
%build
%install
cd $RPM_BUILD_DIR
tar cvf - . | tar xvfC - /
# ---------------------
# FILES Sections
%files
LEOF
}
make_osg()
{
RPM_BUILD_DIR=/usr/src/redhat/BUILD/OpenSceneGraph-$REV
rm -rf $RPM_BUILD_DIR
mkdir $RPM_BUILD_DIR
s_install $TOPDIR/lib 755 $INST_LIBS
s_install $TOPDIR/lib/osgPlugins 744 $INST_PLUGINS
s_install $TOPDIR/bin 755 $INST_DEMOS
make_targz OpenSceneGraph-$REV
make_spec OpenSceneGraph
print_attr $INST_LIBS 755 >> $TOPDIR/dist/RPM/OpenSceneGraph.spec
print_attr $INST_PLUGINS 755 >> $TOPDIR/dist/RPM/OpenSceneGraph.spec
print_attr $INST_DEMOS 755 >> $TOPDIR/dist/RPM/OpenSceneGraph.spec
rpm -bb --clean $TOPDIR/dist/RPM/OpenSceneGraph.spec
mv /usr/src/redhat/RPMS/i386/OpenSceneGraph-$REV-$REL.i386.rpm dist/RPM
}
make_osg_dev()
{
RPM_BUILD_DIR=/usr/src/redhat/BUILD/OpenSceneGraph_dev-$REV
rm -rf $RPM_BUILD_DIR
mkdir $RPM_BUILD_DIR
for d in `ls $TOPDIR/include | grep -v CVS`
do
[ -d $TOPDIR/include/$d ] && \
s_install $TOPDIR/include/$d 644 $INST_INCLUDE/$d
done
for d in `ls $TOPDIR/src/Demos | grep -v CVS`
do
[ -d $TOPDIR/src/Demos/$d ] && \
s_install $TOPDIR/src/Demos/$d 644 $INST_DEMO_SRC/$d
done
make_targz OpenSceneGraph_dev-$REV
make_spec OpenSceneGraph_dev
for d in `ls -1 $RPM_BUILD_DIR/$INST_INCLUDE`
do
print_attr $INST_INCLUDE/$d 755 >> $TOPDIR/dist/RPM/OpenSceneGraph_dev.spec
done
for d in `ls -1 $RPM_BUILD_DIR/$INST_DEMO_SRC`
do
print_attr $INST_DEMO_SRC/$d 755 >> $TOPDIR/dist/RPM/OpenSceneGraph_dev.spec
done
rpm -bb --clean $TOPDIR/dist/RPM/OpenSceneGraph_dev.spec
mv /usr/src/redhat/RPMS/i386/OpenSceneGraph_dev-$REV-$REL.i386.rpm dist/RPM
}
if [ "`whoami`" != "root" ]
then
echo
echo " === makerpm : You must be root do make the RPM distribution."
echo
exit 1
fi
if [ $# -ne 8 ]
then
echo
echo makerpm : Internal Error - Bad Usage
echo
exit 1
fi
TOPDIR=$1
INST_LIBS=$2
INST_PLUGINS=$3
INST_INCLUDE=$4
INST_DEMOS=$5
INST_DEMO_SRC=$6
INST_DOC=$7
INST_DATA=$8
REV="`$TOPDIR""/bin/osgversion`"
[ -z "$REV" ] && die "makerpm: requires a functional $TOPDIR/bin/osgversion"
REL=1
make_osg
make_osg_dev
exit 0