Skip to content

Commit

Permalink
multilib-fix: use '-' as field separator by default
Browse files Browse the repository at this point in the history
Also remove --additional-suffix and add --field-separator option
instead.

Fixes #2.
  • Loading branch information
praiskup committed Jun 13, 2016
1 parent e4db7be commit d285acf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
28 changes: 14 additions & 14 deletions multilib-fix
Expand Up @@ -30,14 +30,15 @@ test "$opt_arch" = ppc64p7 && opt_arch=ppc64

opt_buildroot=$(pwd)
opt_verbose=:
opt_additional_suffix=
opt_field_separator=-

# TODO: we could pretty easily implement other then 'cpp-header' stubs, if the
# target file type allows some kind of "transparent" file inclusion. For
# example shell scripts might use '. "${destdir}/${filename}_x86_64.sh'.
# The solution is taken from Fedora PostgreSQL RPM package.
print_stub ()
{
replacement=$filename$opt_field_separator
cat <<EOF
/*
* Kluge to support multilib installation of both 32- and 64-bit RPMS:
Expand All @@ -52,21 +53,21 @@ cat <<EOF
* But that option is deprecated anyway.
*/
#if defined(__x86_64__)
#include "${filename}${opt_additional_suffix}_x86_64.h"
#include "${replacement}x86_64.h"
#elif defined(__i386__)
#include "${filename}${opt_additional_suffix}_i386.h"
#include "${replacement}i386.h"
#elif defined(__ppc64__) || defined(__powerpc64__)
#include "${filename}${opt_additional_suffix}_ppc64.h"
#include "${replacement}ppc64.h"
#elif defined(__ppc__) || defined(__powerpc__)
#include "${filename}${opt_additional_suffix}_ppc.h"
#include "${replacement}ppc.h"
#elif defined(__s390x__)
#include "${filename}${opt_additional_suffix}_s390x.h"
#include "${replacement}s390x.h"
#elif defined(__s390__)
#include "${filename}${opt_additional_suffix}_s390.h"
#include "${replacement}s390.h"
#elif defined(__sparc__) && defined(__arch64__)
#include "${filename}${opt_additional_suffix}_sparc64.h"
#include "${replacement}sparc64.h"
#elif defined(__sparc__)
#include "${filename}${opt_additional_suffix}_sparc.h"
#include "${replacement}sparc.h"
#endif
EOF
}
Expand All @@ -89,9 +90,8 @@ script only through available RPM macros.
--buildroot prefix (directory where we play with installed files, usually
after 'make install DESTDIR=buildroot')
--file for example /some/path/test.h
--additional-suffix we usually move 'test.h' to 'test_\$ARCH.h'. However
this file could already exist. With this option the multilib
file will be named 'test_\$ARCH\$SUFFIX.h'
--field-separator by default we move filename.h to filename<SEP><ARCH>.h; this
option option allows you to override the <SEP> part
--verbose print some useful information
--help show this help
EOF
Expand Down Expand Up @@ -122,7 +122,7 @@ while test $# -gt 0
do
_opt=$1 ; shift
case $_opt in
--buildroot|--arch|--additional-suffix|--file)
--buildroot|--arch|--file|--field-separator)
_raw_opt=$(echo "$_opt" | sed -e 's/^--//' -e 's/-/_/g')
eval "opt_$_raw_opt=\$1"
shift || die "$_opt requires argument"
Expand Down Expand Up @@ -159,7 +159,7 @@ filename=${orig_basename%%.[a-zA-Z0-9_]}
suffix=${orig_basename##${filename}}

# --> ../test_x86_64.h (on x86_64)
multilib_file="$destdir/$filename${opt_additional_suffix}_$opt_arch$suffix"
multilib_file="$destdir/$filename$opt_field_separator$opt_arch$suffix"

test -f "$original_file" || die "can't find '$original_file'"

Expand Down
5 changes: 4 additions & 1 deletion multilib-rpm-config.spec
Expand Up @@ -11,7 +11,7 @@
Summary: Multilib packaging helpers
Name: multilib-rpm-config
Version: 1
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
URL: https://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks

Expand Down Expand Up @@ -56,6 +56,9 @@ install -m 755 -p %{SOURCE0} %{buildroot}/%{ml_fix}


%changelog
* Mon Jun 13 2016 Pavel Raiskup <praiskup@redhat.com> - 1-4
- use '-' as field separator

* Thu Jun 09 2016 Pavel Raiskup <praiskup@redhat.com> - 1-3
- package separately from redhat-rpm-config

Expand Down

0 comments on commit d285acf

Please sign in to comment.