summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-10-15 14:11:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-10-15 14:11:02 +0000
commit18408afbc7c4c4e67e91cc8a3a61232d6efadfc0 (patch)
treeaee331234100b175c2c0baa4f8b4d2211fd4f824 /scripts
parentReorganized a lot per Jennifer's suggestions. (diff)
downloadrtems-18408afbc7c4c4e67e91cc8a3a61232d6efadfc0.tar.bz2
Ralf Corsepius (corsepiu@faw.uni-ulm.de) submitted these scripts to
help build RPMs.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/README94
-rw-r--r--scripts/mkbspspec31
-rwxr-xr-xscripts/mkrpms32
-rwxr-xr-xscripts/mkspec14
-rw-r--r--scripts/mktoolspec33
-rw-r--r--scripts/rtems.spec.in70
-rw-r--r--scripts/toolchain.spec.in125
7 files changed, 399 insertions, 0 deletions
diff --git a/scripts/README b/scripts/README
new file mode 100644
index 0000000000..d202f0fffc
--- /dev/null
+++ b/scripts/README
@@ -0,0 +1,94 @@
+
+ RPM support for BSPs
+ ====================
+
+Introduction
+------------
+
+Building an rpm requires to have a tar archive of the sources, and a
+rpm-spec files specifying the details of building.
+
+To support per bsp rpms, one rpm-spec is used per BSP.
+Instead of writing one rpm-spec for each BSP, I have written a shell script
+(mkspec) which generates one *.spec (rtems-<target_alias>-<bsp>.spec) per BSP
+bsp from an rpm-spec template (rtems.spec.in).
+
+A second shell script (mkrpms) is a convienience script which invokes a
+sequence of building rpms for several bsps.
+
+mkspec
+------
+
+mkspec takes two arguments:
+$1 ... the bsp to be built
+$2 ... the target_alias this bsp belongs to
+
+Invoking mkspecs will generate a rtems-<target_alias>-<bsp>.spec either in
+/usr/src/packages/SPECS (SuSE convention) or
+/usr/src/redhat/SPECS (Redhat convention) or
+/usr/src/SPECS
+
+Eg. ./mkspec gensh1 sh-rtemself generates
+/usr/src/packages/SPECS/rtems-sh-rtemself-gensh1.spec on SuSE-6.2.
+
+Building BSP-rpms
+-----------------
+
+0. Login as root.
+
+1. Install a tarball of RTEMS's sources (with version number attached!) to
+/usr/src/[packages|redhat]/SOURCES
+Eg.
+tar czvf /usr/src/packages/SOURCES/rtems-<VERSION>.tar.gz rtems-<VERSION>
+
+2. Generate and install the required rpm-spec file[s]
+cd rtems-<VERSION>/scripts/
+mkspec <bsp> <target_alias>
+
+3. Build the rpms
+Building a binary rpm:
+rpm -bb /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-<bsp>.spec
+
+Building a source and binary rpm
+rpm -ba /usr/src/[packages|redhat]/SPECS/rtems-<target_alias>-<bsp>.spec
+
+Note: a BSP's src.rpm contains its spec-file and the tar-archive of the
+sources (approx. 4-5MB per BSP).
+
+Known Bugs/Deficiencies
+-----------------------
+
+* All files mentioned in here are in its early infancy ;-)
+
+* Building for a single bsp requires an own copy of the source tree inside
+rpm's build directory.
+* Building inside the RTEMS source tree doesn't work.
+* Dependencies on toolchain-rpms not yet supported in rtems.spec.in.
+* Installing multiple binary bsp rpms for the same target can cause
+warnings from rpm, because these bsp-rpms share files.
+* rtems.spec.in is prepared for rpm relocation support, but RTEMS is not
+relocatible (yet?)
+* rtems.spec.in deserves to be extended (description, authors etc)
+* The final packaging stage to build a binary rpm takes an awful lot of
+time - deserves to be investigated.
+* Some RTEMS's cross executables (eg. hello.exe for sparc-rtems/erc32) cause
+warnings from rpm and/or objdump. AFAIS, this is a bug in rpm.
+* Probably many more ...
+
+* Last but not least: RTEMS should be split.
+
+Remarks
+-------
+* It would make sense to split RTEMS host/cross-tools and files depending on
+the target only (<target_alias>/make/*.cfg -- Whow, RTEMS really has files
+which depend on the target only :) into separate rpms.
+* Instead of using a single rpm-spec for each bsp, RTEMS could also use a
+single rpm-spec for all (or at least a given subset of all) bsps of a target.
+* rpm -b[b|a] leaves its built trees unpacked in
+/usr/src/[packages|redhat]/BUILD. Therefore you will rather soon run out of disc
+space if not removing them. (Use rpm --clean -b[a|b] for cleaning them up
+automatically after building)
+* The size of binary rpms can differ up to one magnitude depending on the
+target/bsp (eg. sh-rtems/gensh1 ~10MB vs. sh-rtemself/gensh1 ~32MB)
+
+Ralf Corsepius, 1999/10/14
diff --git a/scripts/mkbspspec b/scripts/mkbspspec
new file mode 100644
index 0000000000..49dbf459ac
--- /dev/null
+++ b/scripts/mkbspspec
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+
+RTEMS_DIR=`dirname $0`
+RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
+sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
+
+bsp=$1
+target_alias=$2
+release=0
+
+# Some linux distributions use /usr/src/packages
+# redhat uses /usr/src/redhat
+# others might use /usr/src
+if test -d /usr/src/packages/SPECS;
+then
+dst=/usr/src/packages/SPECS;
+elif test -d /usr/src/redhat/SPECS;
+ then
+dst=/usr/src/redhat/SPECS;
+elif test -d /usr/src/SPECS/;
+then
+dst=/usr/src/SPECS;
+fi
+
+sed -e "s%@Version@%${RTEMS_VERSION}%g" \
+-e "s%@bsp@%${bsp}%g" \
+-e "s%@Release@%${release}%g" \
+-e "s%@target_alias@%${target_alias}%g" \
+< ${RTEMS_DIR}/rtems.spec.in \
+> ${dst}/rtems-$target_alias-$bsp.spec
diff --git a/scripts/mkrpms b/scripts/mkrpms
new file mode 100755
index 0000000000..72e9bae494
--- /dev/null
+++ b/scripts/mkrpms
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#
+# A simple shell script to build several rpms in a row.
+#
+# Used for testing rtems.spec.in
+#
+
+# Some linux distributions use /usr/src/packages
+# redhat uses /usr/src/redhat
+# others might use /usr/src
+if test -d /usr/src/packages/SPECS;
+then
+dst=/usr/src/packages/SPECS;
+elif test -d /usr/src/redhat/SPECS;
+ then
+dst=/usr/src/redhat/SPECS;
+elif test -d /usr/src/SPECS/;
+then
+dst=/usr/src/SPECS;
+fi
+
+./mkspec pc386 i386-rtems
+rpm -ba $dst/rtems-i386-rtems-pc386.spec
+
+./mkspec gensh1 sh-rtemself
+rpm -ba $dst/rtems-sh-rtemself-gensh1.spec
+
+./mkspec mcp750 powerpc-rtems
+rpm -ba $dst/rtems-powerpc-rtems-mcp750.spec
+
+
diff --git a/scripts/mkspec b/scripts/mkspec
new file mode 100755
index 0000000000..8f725bdf5e
--- /dev/null
+++ b/scripts/mkspec
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+
+RTEMS_DIR=`dirname $0`
+RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
+sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
+
+bsp=$1
+target_alias=$2
+release=0
+
+${RTEMS_DIR}/scripts/mkbspspec $bsp $target_alias
+${RTEMS_DIR}/scripts/mktoolspec $target_alias
+
diff --git a/scripts/mktoolspec b/scripts/mktoolspec
new file mode 100644
index 0000000000..a9cf92a869
--- /dev/null
+++ b/scripts/mktoolspec
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+
+RTEMS_DIR=`dirname $0`
+RTEMS_VERSION=`grep Version ${RTEMS_DIR}/../VERSION | \
+sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'`
+
+bsp=$1
+target_alias=$2
+release=0
+
+# Some linux distributions use /usr/src/packages
+# redhat uses /usr/src/redhat
+# others might use /usr/src
+if test -d /usr/src/packages/SPECS;
+then
+dst=/usr/src/packages/SPECS;
+elif test -d /usr/src/redhat/SPECS;
+ then
+dst=/usr/src/redhat/SPECS;
+elif test -d /usr/src/SPECS/;
+then
+dst=/usr/src/SPECS;
+fi
+
+sed -e "s%@Version@%${RTEMS_VERSION}%g" \
+-e "s%@bsp@%${bsp}%g" \
+-e "s%@Release@%${release}%g" \
+-e "s%@target_alias@%${target_alias}%g" \
+< ${RTEMS_DIR}/toolchain.spec.in \
+> ${dst}/rtems-$target_alias-tools.spec
+
+
diff --git a/scripts/rtems.spec.in b/scripts/rtems.spec.in
new file mode 100644
index 0000000000..f14b5ae99a
--- /dev/null
+++ b/scripts/rtems.spec.in
@@ -0,0 +1,70 @@
+#
+# spec file for package rtems
+#
+# Copyright (c) 1999 OARCorp, Huntsville, AL
+#
+# please send bugfixes or comments to joel@OARcorp.com
+#
+
+# neededforbuild @target_alias@-binutils @target_alias@-gcc
+
+Vendor: OAR Corporation
+Distribution: Linux
+Name: rtems-@target_alias@-@bsp@
+Release: @Release@
+Copyright: 1999 OARCorp
+Group: unsorted
+Provides: rtems-@target_alias@-@bsp@
+
+Autoreqprov: on
+Packager: corsepiu@faw.uni-ulm.de
+
+Version: @Version@
+Summary: A free operating system for embedded systems
+Source: rtems-@Version@.tar.gz
+# We claim to be relocatible, but in fact we are not
+Prefix: /opt
+Buildroot: /tmp
+# Patch:
+%description
+RTEMS is a free operating system for embedded systems.
+
+Authors:
+--------
+ Joel Sherrill (joel@oarcorp.com)
+ ...
+
+%prep
+# untar the sources inside rtems-@target_alias@-@bsp@-@Version@
+%setup -c -n rtems-@target_alias@-@bsp@-@Version@
+# no patch needed
+# %patch
+%build
+# rtems does not support building inside the source tree
+ if test ! -f rtems-@Version@/configure;
+ then
+ ( cd rtems-@Version@; ./autogen )
+ fi
+ ./rtems-@Version@/configure \
+ --target=@target_alias@ \
+ --prefix=/opt/rtems/@target_alias@ \
+ --enable-networking \
+ --enable-posix \
+ --enable-cxx \
+ --disable-tests \
+ --enable-rdbg \
+ --disable-multiprocessing
+ make RTEMS_BSP=@bsp@
+%install
+ make RTEMS_BSP=@bsp@ prefix=$RPM_BUILD_ROOT/opt/rtems/@target_alias@ install
+%files
+%dir /opt/rtems/@target_alias@/@bsp@
+/opt/rtems/@target_alias@/@bsp@/*
+/opt/rtems/@target_alias@/make/*
+/opt/rtems/@target_alias@/bin/install-if-change
+/opt/rtems/@target_alias@/bin/packhex
+/opt/rtems/@target_alias@/bin/unhex
+/opt/rtems/@target_alias@/bin/lock-directory
+/opt/rtems/@target_alias@/bin/unlock-directory
+/opt/rtems/@target_alias@/bin/eolstrip
+/opt/rtems/@target_alias@/bin/cklength
diff --git a/scripts/toolchain.spec.in b/scripts/toolchain.spec.in
new file mode 100644
index 0000000000..a1c04957fc
--- /dev/null
+++ b/scripts/toolchain.spec.in
@@ -0,0 +1,125 @@
+#
+# spec file for package rtems
+#
+# Copyright (c) 1999 OARCorp, Huntsville, AL
+#
+# please send bugfixes or comments to joel@OARcorp.com
+#
+
+# neededforbuild @target_alias@-binutils @target_alias@-gcc
+
+Vendor: OAR Corporation
+Distribution: Linux
+Name: rtems-@target_alias@-tools
+Release: @Release@
+Copyright: 1999 OARCorp
+Group: unsorted
+Provides: rtems-@target_alias@-tools
+
+Autoreqprov: on
+Packager: corsepiu@faw.uni-ulm.de
+
+Version: @Version@
+Summary: rtems gcc tool chain for target @target_alias@
+Source0: gcc-2.95.1.tar.gz
+Source1: newlib-1.8.2.tar.gz
+Source2: binutils-2.9.5.tar.gz
+Patch0: gcc-2.95.1-rtems-19991014.diff
+Patch1: newlib-1.8.2-rtems-19991014.diff
+Patch2: binutils-2.9.5-rtems-19991014.diff
+
+Buildroot: /tmp
+# Patch:
+%description
+RTEMS is a free operating system for embedded systems.
+
+Authors:
+--------
+ Joel Sherrill (joel@oarcorp.com)
+ ...
+
+%prep
+# untar the sources inside rtems-@target_alias@-@bsp@-@Version@
+%setup -c -n rtems-@target_alias@-tools -a 1 -a 2
+
+# %setup -c -n rtems-@target_alias@ -a 1 -a 2
+%patch0 -p0
+%patch1 -p0
+%patch2 -p0
+
+mkdir src
+( cd src
+ # The configure scripts and share libraries should be taken from
+ # the tool component with the newest version.
+ GET_CONFIGURE_SCRIPTS_FROM=gcc-2.95.1
+ for f in config config.guess config.sub configure configure.in \
+ config-ml.in Makefile.in install-sh move-if-change \
+ mkinstalldirs libiberty config.if ltconfig missing
+ do
+ ln -s ../${GET_CONFIGURE_SCRIPTS_FROM}/$f .
+ done
+
+ # Link in GCC or EGCS
+ for f in gcc libio libstdc++ texinfo xiberty
+ do
+ ln -s ../gcc-2.95.1/${f} .
+ done
+
+ # Get these components from binutils
+ for f in bfd binutils gas gprof ld opcodes etc
+ do
+ ln -s ../binutils-2.9.5/$f .
+ done
+
+ # Now get the C library
+ ln -s ../newlib-1.8.2/newlib .
+)
+
+%build
+test -d build || mkdir build
+( cd build
+ ../src/configure --target=@target_alias@ \
+ --with-gnu-as --with-gnu-ld --verbose \
+ --prefix=/opt/rtems \
+ --with-sys-includes=$RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include
+
+ test -d $RPM_BUILD_ROOT/opt \
+ || mkdir $RPM_BUILD_ROOT/opt
+ test -d $RPM_BUILD_ROOT/opt/rtems \
+ || mkdir $RPM_BUILD_ROOT/opt/rtems
+ test -d $RPM_BUILD_ROOT/opt/rtems/@target_alias@ \
+ || mkdir $RPM_BUILD_ROOT/opt/rtems/@target_alias@
+ test -d $RPM_BUILD_ROOT/opt/rtems/@target_alias@/include \
+ || mkdir $RPM_BUILD_ROOT/opt/rtems/@target_alias@/include
+ test -d $RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include \
+ || mkdir $RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include
+
+ srclimits=../src/newlib/libc/sys/rtems/include/limits.h
+ for dir in $RPM_BUILD_ROOT/opt/rtems/@target_alias@/include \
+ $RPM_BUILD_ROOT/opt/rtems/@target_alias@/sys-include
+ do
+ cp ${srclimits} ${dir}
+ done
+
+ make LANGUAGES="c c++" all
+
+ cd gcc
+ rm -f stmp-multilib
+ find . -name "*.a" -print | xargs -e rm -f
+
+ make LANGUAGES="c c++" all
+ cd ..
+)
+
+%install
+( cd build
+ make prefix=$RPM_BUILD_ROOT/opt/rtems LANGUAGES="c c++" install
+)
+
+%files
+/opt/rtems/@target_alias@/bin
+/opt/rtems/@target_alias@/include
+/opt/rtems/@target_alias@/lib
+/opt/rtems/@target_alias@/sys-include
+/opt/rtems/bin/@target_alias@*
+/opt/rtems/lib/gcc-lib/@target_alias@/2.95.1