Hi!
authorjbj <devnull@localhost>
Wed, 19 Apr 2000 16:03:49 +0000 (16:03 +0000)
committerjbj <devnull@localhost>
Wed, 19 Apr 2000 16:03:49 +0000 (16:03 +0000)
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

Makefile.am
configure.in
installplatform
macros.in
platform.in
rpmpopt.in
scripts/Makefile.am
scripts/brp-sparc64-linux [new file with mode: 0644]

index 04bbfea..e2fb4b2 100644 (file)
@@ -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
 
index 422a829..b16c39a 100644 (file)
@@ -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)
index ffd8cd8..f2a6d7c 100755 (executable)
@@ -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
index ff82e84..7f42e5c 100644 (file)
--- 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):
 #
 # 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
index c0b7855..b49f38b 100644 (file)
@@ -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@
 # ---- 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@
index 531fb24..d3d6808 100644 (file)
@@ -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.
index 1bb7d41..163a2ba 100644 (file)
@@ -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 (file)
index 0000000..5f47c77
--- /dev/null
@@ -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