summaryrefslogtreecommitdiff
path: root/rpm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2009-08-14 02:21:49 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2009-08-14 02:21:49 +0000
commitc7f37382c877e9febdbc2a7fd5fe5fe7034bd606 (patch)
treef91fc23727ffa7c3f0c8bf59e378f353e3365bd6 /rpm
parent838c528d1f95765dc8c5eaa6715ff9dd35fe61e8 (diff)
downloadMPC-c7f37382c877e9febdbc2a7fd5fe5fe7034bd606.tar.gz
ChangeLogTag: Fri Aug 14 02:20:11 UTC 2009 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'rpm')
-rw-r--r--rpm/MPC.spec30
-rwxr-xr-xrpm/buildrpm.sh74
2 files changed, 104 insertions, 0 deletions
diff --git a/rpm/MPC.spec b/rpm/MPC.spec
new file mode 100644
index 00000000..45f78585
--- /dev/null
+++ b/rpm/MPC.spec
@@ -0,0 +1,30 @@
+Summary: MPC - The Makefile, Project and Workspace Creator.
+Name: MPC
+Version: VERSION
+Release: 0
+License: Open Software License
+Group: Software Development
+BuildRoot: /tmp/mpc
+Source: %{name}-%{version}.tar.bz2
+URL: http://www.ociweb.com/products/mpc
+Vendor: Object Computing, Inc.
+Packager: Chad Elliott <elliott_c@ociweb.com>
+buildarch: noarch
+%description
+MPC (Make, Project and workspace Creator) is an open source tool, developed
+by OCI and written in Perl. It is designed to generate a variety of tool
+specific project files from a common baseline.
+%defattr(-,root,root)
+%pre
+%prep
+%setup
+%build
+%install
+tar cf - * | (cd $RPM_BUILD_ROOT && tar xf -)
+%post
+ln -sf /usr/lib/MPC/mwc.pl /usr/bin
+ln -sf /usr/lib/MPC/mpc.pl /usr/bin
+%postun
+rm -f /usr/bin/mwc.pl /usr/bin/mpc.pl
+%files
+/usr/lib/MPC
diff --git a/rpm/buildrpm.sh b/rpm/buildrpm.sh
new file mode 100755
index 00000000..c99c7d3b
--- /dev/null
+++ b/rpm/buildrpm.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# ******************************************************************
+# Author: Chad Elliott
+# Date: 8/13/2009
+# Description: Create an MPC rpm based on the current version number.
+# $Id$
+# ******************************************************************
+
+## First find out where this script is located
+if [ "$0" != "`basename $0`" ]; then
+ if [ "`echo $0 | cut -c1`" = "/" ]; then
+ loc="`dirname $0`"
+ else
+ loc="`pwd`/`dirname $0`"
+ fi
+else
+ ## Do my own 'which' here
+ loc="."
+ for i in `echo $PATH | tr ':' '\012'`; do
+ if [ -x "$i/$0" -a ! -d "$i/$0" ]; then
+ loc="$i"
+ break
+ fi
+ done
+fi
+
+## Now, get back to where the main MPC script is located
+while [ ! -x $loc/mpc.pl ]; do
+ loc=`dirname $loc`
+done
+
+## Save the MPC version
+VERSION=`$loc/mpc.pl --version | sed 's/.*v//'`
+
+## This is where we'll create the spec file and do the work
+WDIR=/tmp/mpc.$$
+
+## This is the directory name that RPM expects
+MDIR=MPC-$VERSION
+
+## This corresponds to BuildRoot in MPC.spec
+BDIR=/tmp/mpc
+
+## The directory where RPM
+if [ -x /usr/src/redhat ]; then
+ RPMLOC=/usr/src/redhat
+else
+ RPMLOC=/usr/src/packages
+fi
+
+## Create our working directory and make the spec file
+mkdir -p $WDIR
+cd $WDIR
+sed "s/VERSION/$VERSION/" $loc/rpm/MPC.spec > MPC.spec
+
+## Make a copy of the original MPC source to the new directory
+mkdir -p $MDIR/usr/lib/MPC
+cd $loc
+tar --exclude=.svn -cf - . | (cd $WDIR/$MDIR/usr/lib/MPC; tar -xf -)
+
+## Create the build source tar.bz2
+cd $WDIR
+tar cf $RPMLOC/SOURCES/$MDIR.tar $MDIR
+bzip2 -9f $RPMLOC/SOURCES/$MDIR.tar
+
+## Perform the RPM creation step
+rm -rf $BDIR
+mkdir -p $BDIR
+rpmbuild -bb MPC.spec
+
+## Clean everything up
+cd ..
+rm -rf $WDIR $BDIR