summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-04-19 16:03:49 +0000
committerjbj <devnull@localhost>2000-04-19 16:03:49 +0000
commitc89b7ff341c504ce2f684149d46b2e6939faed31 (patch)
treefcb2f681bc1fadfaf917dc7bb5eaa58394e261bb
parentbb4eafd53dc21710f0618499cba70bc4d046aa00 (diff)
downloadlibrpm-tizen-c89b7ff341c504ce2f684149d46b2e6939faed31.tar.gz
librpm-tizen-c89b7ff341c504ce2f684149d46b2e6939faed31.tar.bz2
librpm-tizen-c89b7ff341c504ce2f684149d46b2e6939faed31.zip
Hi!
I'd like to start building sparc64 packages (eventhough the install rule details are yet to be designed - IMHO if 64bit SPARC userland is going into 7.0 we should rebuild all packages into 64bit in the next months or so to have time to chase bugs etc.), and this is about what I need. Basically I'd like to have %{_lib} to stand for the last part (normally "lib") of dirname for directories like /lib, /usr/lib, /usr/X11R6/lib because on sparc64-linux they are /lib64, /usr/lib64, /usr/X11R6/lib64 (and on Solaris /lib/sparcv9, /usr/lib/sparcv9 etc.), so that one can use things like /usr/%{_lib} in the spec files. Another thing which I need is an arch specific build root policy. This patch does a few things: 1) add installplatform into EXTRA_DIST files, so that it is actually invoked during rpm build not from CVS 2) Define %_lib lib and let target specific macros override it 3) Split __spec_install_post into __arch_install_post and __os_install_post, --buildpolicy now specifies the __os_install_post part only. spec files can still override the __arch_install_post if the want to. brp-sparc64-linux is used to move 64bit libraries to */lib64 directories from */lib directories if make install of some package left them there. 4) Change installplatform so that on sparc* it creates both sparc and sparc64 target macro dirs (/usr/lib/rpm/sparc{,64}-redhat-linux in sparc*-redhat-linux case). CVS patchset: 3685 CVS date: 2000/04/19 16:03:49
-rw-r--r--Makefile.am2
-rw-r--r--configure.in2
-rwxr-xr-xinstallplatform61
-rw-r--r--macros.in13
-rw-r--r--platform.in20
-rw-r--r--rpmpopt.in2
-rw-r--r--scripts/Makefile.am16
-rw-r--r--scripts/brp-sparc64-linux29
8 files changed, 103 insertions, 42 deletions
diff --git a/Makefile.am b/Makefile.am
index 04bbfea48..e2fb4b299 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,7 +7,7 @@ EXTRA_DIST = CHANGES CREDITS GROUPS README.amiga INSTALL \
autodeps/none autodeps/*.prov autodeps/*.req autogen.sh \
gendiff po/*.in po/*.po po/rpm.pot \
python/*.am python/*.in python/*.c python/*.h python/testit \
- rpm.magic rpmpopt rpm.spec
+ rpm.magic rpmpopt rpm.spec installplatform
EXTRA_PROGRAMS = rpmconvert
diff --git a/configure.in b/configure.in
index 422a8297a..b16c39afd 100644
--- a/configure.in
+++ b/configure.in
@@ -918,6 +918,8 @@ fi
LOCALEDIR="`echo ${usrprefix}/share/locale`"
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
AC_SUBST(LOCALEDIR)
+LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
+AC_SUBST(LIBDIR)
RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR")
AC_SUBST(RPMCONFIGDIR)
diff --git a/installplatform b/installplatform
index ffd8cd816..f2a6d7c0f 100755
--- a/installplatform
+++ b/installplatform
@@ -15,27 +15,48 @@ E_O_F
RPM="./rpm --rcfile $TEMPRC"
-ARCH="`$RPM --eval '%{_arch}'`"
+arch="`$RPM --eval '%{_arch}'`"
VENDOR="`$RPM --eval '%{_vendor}'`"
OS="`$RPM --eval '%{_os}'`"
-TARGET_PLATFORM="`$RPM --eval '%{_target_platform}'`"
-TARGET="`$RPM --eval '%{_target}'`"
-
-PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
-
-[ -d $PPD ] || mkdir $PPD
-
-RPMRC_OPTFLAGS="`$RPM --eval '%{optflags}'`"
-RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
-
-
-cat $PLATFORM | \
- sed -e s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS, -e 's,\${,%{_,' \
-> ${PPD}/macros
-
-#
-# Better try to create these too until the smoke clears. Yuck.
-[ "${ARCH}-${VENDOR}-${OS}" = "${TARGET}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET}
-[ "${ARCH}-${VENDOR}-${OS}" = "${TARGET_PLATFORM}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET_PLATFORM}
+target_platform="`$RPM --eval '%{_target_platform}'`"
+target="`$RPM --eval '%{_target}'`"
+
+case "$arch" in
+ sparc*) SUBSTS="s_sparc64_sparc_ s_sparc_sparc64_" ;;
+ *) SUBST=y___ ;;
+esac
+
+for SUBST in $SUBSTS; do
+ ARCH=`echo $arch | sed -e $SUBST`
+ TARGET_PLATFORM=`echo $target_platform | sed -e $SUBST`
+ TARGET=`echo $target | sed -e $SUBST`
+ LIB=lib
+
+ PPD="${DESTDIR}/${pkglibdir}/${ARCH}-${VENDOR}-${OS}"
+
+ [ -d $PPD ] || mkdir $PPD
+
+ RPMRC_OPTFLAGS="`$RPM --eval '%{optflags}'`"
+ RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
+
+ ARCH_INSTALL_POST='%{nil}'
+ case "${ARCH}-${OS}" in
+ sparc64-linux) ARCH_INSTALL_POST=${pkglibdir}/brp-sparc64-linux ;;
+ esac
+
+ cat $PLATFORM | \
+ sed -e s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS, \
+ -e s,@RPMRC_ARCH@,$ARCH, \
+ -e s,@LIB@,$LIB, \
+ -e s,@ARCH_INSTALL_POST@,$ARCH_INSTALL_POST, \
+ -e 's,\${,%{_,' \
+ > ${PPD}/macros
+
+ #
+ # Better try to create these too until the smoke clears. Yuck.
+ [ "${ARCH}-${VENDOR}-${OS}" = "${TARGET}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET}
+ [ "${ARCH}-${VENDOR}-${OS}" = "${TARGET_PLATFORM}" ] || ln -sf ${ARCH}-${VENDOR}-${OS} ${DESTDIR}/${pkglibdir}/${TARGET_PLATFORM}
+
+done
rm $TEMPRC
diff --git a/macros.in b/macros.in
index ff82e8436..7f42e5ca2 100644
--- a/macros.in
+++ b/macros.in
@@ -1,4 +1,4 @@
-# $Id: macros.in,v 1.50 2000/04/06 15:20:29 jbj Exp $
+# $Id: macros.in,v 1.51 2000/04/19 16:03:49 jbj Exp $
#==============================================================================
# Macro naming conventions (preliminary):
#
@@ -226,6 +226,9 @@
# XXX use the rpmrc instantiated macro for now
#%optflags -O2
+%__arch_install_post %{nil}
+%__os_install_post %{___build_post}
+
#==============================================================================
# ---- Scriptlet template templates.
# Global defaults used for building scriptlet templates.
@@ -320,7 +323,10 @@ cd %{u2p:%{_builddir}}\
%__spec_install_cmd %{___build_cmd}
%__spec_install_pre %{___build_pre}
%__spec_install_body %{___build_body}
-%__spec_install_post %{___build_post}
+%__spec_install_post\
+%{__arch_install_post}\
+%{__os_install_post}\
+%{nil}
%__spec_install_template #!%{__spec_install_shell}\
%{__spec_install_pre}\
%{nil}
@@ -400,7 +406,8 @@ cd %{u2p:%{_builddir}}\
%_sysconfdir %{_prefix}/etc
%_sharedstatedir %{_prefix}/com
%_localstatedir %{_prefix}/var
-%_libdir %{_exec_prefix}/lib
+%_lib lib
+%_libdir %{_exec_prefix}/%{_lib}
%_includedir %{_prefix}/include
%_oldincludedir /usr/include
%_infodir %{_prefix}/info
diff --git a/platform.in b/platform.in
index c0b78555d..b49f38b12 100644
--- a/platform.in
+++ b/platform.in
@@ -3,7 +3,7 @@
#==============================================================================
# ---- per-platform macros.
#
-%_arch @RPMCANONARCH@
+%_arch @RPMRC_ARCH@
%_vendor @RPMCANONVENDOR@
%_os @RPMCANONOS@
%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
@@ -21,7 +21,8 @@
%_sysconfdir @sysconfdir@
%_sharedstatedir @sharedstatedir@
%_localstatedir @localstatedir@
-%_libdir @libdir@
+%_lib @LIB@
+%_libdir @LIBDIR@
%_includedir @includedir@
%_oldincludedir @oldincludedir@
%_infodir @infodir@
@@ -31,15 +32,16 @@
# ---- Build policy macros.
#
#------------------------------------------------------------------------
-# Expanded at end of %install (Red Hat uses these for 6.2)
+# Expanded at end of %install
#
-#%__spec_install_post \
-# /usr/lib/rpm/brp-compress \
-# /usr/lib/rpm/brp-strip \
-# /usr/lib/rpm/brp-strip-comment-note \
-#%{nil}
+%__arch_install_post @ARCH_INSTALL_POST@
+%__os_install_post %{___build_post}
+%__spec_install_post\
+ %{__arch_install_post}\
+ %{__os_install_post}\
+%{nil}
#------------------------------------------------------------------------
-# Expanded at end of %prep (Red Hat uses these for 6.2)
+# Expanded at end of %prep
#
%__id_u @__ID_U@
%__chown_Rhf @__CHOWN_RHF@
diff --git a/rpmpopt.in b/rpmpopt.in
index 531fb242a..d3d6808ff 100644
--- a/rpmpopt.in
+++ b/rpmpopt.in
@@ -80,7 +80,7 @@ rpm alias --redhatrequires -q --define '_dbpath /usr/lib/rpmdb/%{_arch}-%{_vendo
rpm alias --i18ndomains --define '_i18ndomains !#:+'
# Build policies enabled from command line. Last policy applies.
-rpm alias --buildpolicy --define '__spec_install_post @RPMCONFIGDIR@/brp-!#:+'
+rpm alias --buildpolicy --define '__os_install_post @RPMCONFIGDIR@/brp-!#:+'
# Preferred db interface:
# 0 linux glibc libdb1 routines.
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 1bb7d4160..163a2ba4c 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -4,10 +4,10 @@ AUTOMAKE_OPTIONS = 1.4 foreign
EXTRA_DIST = \
brp-compress brp-redhat brp-strip brp-strip-comment-note \
- check-prereqs convertrpmrc.sh find-lang.sh find-prov.pl find-req.pl \
- cpanflute find-provides.perl find-requires.perl \
- freshen.sh get_magic.pl getpo.sh http.req magic.prov magic.req \
- perl.prov perl.req rpmdiff rpmdiff.cgi u_pkg.sh \
+ brp-sparc64-linux check-prereqs convertrpmrc.sh find-lang.sh \
+ find-prov.pl find-req.pl cpanflute find-provides.perl \
+ find-requires.perl freshen.sh get_magic.pl getpo.sh http.req \
+ magic.prov magic.req perl.prov perl.req rpmdiff rpmdiff.cgi u_pkg.sh \
vpkg-provides.sh vpkg-provides2.sh
installprefix = $(DESTDIR)
@@ -17,8 +17,8 @@ all:
configdir = ${prefix}/lib/rpm
config_SCRIPTS = \
brp-compress brp-redhat brp-strip brp-strip-comment-note \
- check-prereqs convertrpmrc.sh find-lang.sh find-prov.pl find-req.pl \
- cpanflute find-provides.perl find-requires.perl \
- freshen.sh get_magic.pl getpo.sh http.req magic.prov magic.req \
- perl.prov perl.req rpmdiff rpmdiff.cgi u_pkg.sh \
+ brp-sparc64-linux check-prereqs convertrpmrc.sh find-lang.sh \
+ find-prov.pl find-req.pl cpanflute find-provides.perl \
+ find-requires.perl freshen.sh get_magic.pl getpo.sh http.req \
+ magic.prov magic.req perl.prov perl.req rpmdiff rpmdiff.cgi u_pkg.sh \
vpkg-provides.sh vpkg-provides2.sh
diff --git a/scripts/brp-sparc64-linux b/scripts/brp-sparc64-linux
new file mode 100644
index 000000000..5f47c77ef
--- /dev/null
+++ b/scripts/brp-sparc64-linux
@@ -0,0 +1,29 @@
+#!/bin/sh
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+files=
+LC_ALL=
+LANG=
+
+# Move 64bit ELF objects from /lib, /usr/lib, /usr/X11R6/lib to */lib64
+# directories
+
+for f in `find $RPM_BUILD_ROOT{,/usr,/usr/X11R6}/lib -maxdepth 1 -type f -o -type l 2>/dev/null`; do
+ if objdump -h $f 2>/dev/null | grep ':[ ]*file format elf64-sparc$' >/dev/null 2>&1; then
+ files="$files $f"
+ fi
+done
+for f in $files; do
+ d=`dirname $f`
+ n=`basename $f`
+ if [ ! -d ${d}64 ]; then mkdir -p ${d}64; fi
+ if [ -L $f ]; then
+ l=`ls -l $f | awk '{ print $11 }' | sed 's_lib\(/[^/]*\)$_lib64\1_'`
+ ln -sf $l ${d}64/$n
+ rm -f $f
+ else
+ mv -f $f ${d}64/$n
+ fi
+done