summaryrefslogtreecommitdiffstats
path: root/redhat/build/build_rpm_package.sh
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2014-01-24 20:46:50 +0100
committerFrançois Andriot <albator78@libertysurf.fr>2014-01-24 20:46:50 +0100
commit43429e67cfc03fdf5065e90c197753ec5f15aa19 (patch)
tree3f85e6c48280c03682aa2aa92fca68fd9aa60634 /redhat/build/build_rpm_package.sh
parentdf55195d132cbe6af516c6f1883315f26abd7f4a (diff)
downloadtde-packaging-43429e67cfc03fdf5065e90c197753ec5f15aa19.tar.gz
tde-packaging-43429e67cfc03fdf5065e90c197753ec5f15aa19.zip
RPM Packaging: update build scripts
Diffstat (limited to 'redhat/build/build_rpm_package.sh')
-rwxr-xr-xredhat/build/build_rpm_package.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/redhat/build/build_rpm_package.sh b/redhat/build/build_rpm_package.sh
new file mode 100755
index 000000000..5b274fde2
--- /dev/null
+++ b/redhat/build/build_rpm_package.sh
@@ -0,0 +1,51 @@
+#!/bin/bash -ex
+
+# Usage: build_rpm_package.sh <TDE_PACKAGE> [TDE_VERSION]
+# Example: build_rpm_package.sh tdebase 14.0.0
+
+
+PKGNAME="${1##*/}"
+TDE_VERSION="${2:-14.0.0}"
+
+SPECFILE=$(get_specfile.sh ${PKGNAME} ${TDE_VERSION})
+SOURCES=$(get_source_files.sh ${PKGNAME} ${TDE_VERSION})
+TARBALL=$(get_latest_tarball_filename.sh ${PKGNAME} ${TDE_VERSION} || :)
+VERSION=$(get_latest_tarball_version.sh ${PKGNAME} ${TDE_VERSION} || :)
+case "${VERSION}" in *~pre*) PREVERSION="${VERSION#*~}";; esac
+
+DIST="$(rpmdist.sh --dist)"
+BUILDDIR="/dev/shm/BUILD${DIST}.$(uname -i)"
+BUILDROOTDIR="/dev/shm/BUILDROOT${DIST}.$(uname -i)"
+LOGFILE=/tmp/log.${COMP##*/}
+
+TEMPDIR="$(mktemp -d)"
+cp -f ${SPECFILE} ${SOURCES} ${TARBALL} "${TEMPDIR}"
+
+# Determines if we are running an i386 or x86_64 distro
+if [ "$(rpm -q --qf '%{arch}\n' kernel | tail -n 1)" = "i686" ]; then
+ ARGS="${ARGS} --target=i686"
+fi
+
+[ -d "${BUILDDIR}" ] || mkdir -p "${BUILDDIR}"
+
+
+rpmbuild -ba \
+ --define "_specdir ${TEMPDIR}" \
+ --define "_sourcedir ${TEMPDIR}" \
+ --define "_builddir ${BUILDDIR}" \
+ --define "_buildrootdir ${BUILDROOTDIR}" \
+ --define "tde_version ${TDE_VERSION}" \
+ --define "tde_prefix /opt/trinity" \
+ --define "preversion ${PREVERSION}" \
+ ${ARGS} \
+ "${SPECFILE}"
+RET=$?
+
+# Removes BUILDDIR if build succeeded
+if [ ${RET} -eq 0 ]; then
+ rm -rf "${BUILDDIR}/"*${PKGNAME}-${VERSION}*
+fi
+
+rm -rf "${TEMPDIR}"
+
+exit $RET