RPM Community Forums

Mailing List Message of <rpm-users>

Re: rpm on OSX Lion

From: Anders F Björklund <afb@rpm5.org>
Date: Mon 26 Mar 2012 - 20:33:45 CEST
Message-Id: <30A0669E-8A50-40B2-AF72-12C857AC4296@rpm5.org>
Henri Gomez wrote:

> Hi to all,
> 
> I success in building rpm 5.4.7 on OSX (from tarball)
> 
> First step was to build and install bee crypt 4.2.1, popt 1.1.6,
> db-5.3.15, sqlite 3.7.11, pcre 8.30, zlib 1.2.6 libraries under
> /usr/local (nothing in)

Great! The only thing I added after that was possibly
redoing everything as .src.rpm for bootstrapping, and
making a .pkg for easier first-time user installation...

You don't need any .dmg, if making packages for 10.5
and beyond - they were only needed for 10.4 and earlier.
(since the newer "flatten" their directories, into xar)

> Question :
> 
> What should I do now, I noticed a cpu-os-macros.tar.gz bundled in
> source RPM but not macros available for OSX inside.

Build some software, probably. That is, try some .spec
files and see if it actually works and is useful to you.
Historically, the macros were where vendors "added value".

You can find my macros in devtool.conf (for rpm-5.2),
if you want to use them. Probably won't need PowerPC,
when only targeting Mac OS X 10.7 and later anyway ?

    for ARCH in ppc i386 ppc64 x86_64; do
    if [ "$ARCH" = "ppc64" -o "$ARCH" = "x86_64" ]; then BITS=-m64; else BITS=-m32; fi
    mkdir -p /tmp/rpm-root/usr/local/lib/rpm/$ARCH-darwin
    sed -e "s/^\\\\%/%/" <<__EOF__ >/tmp/rpm-root/usr/local/lib/rpm/$ARCH-darwin/macros
# Per-platform rpm configuration file.

#==============================================================================
# ---- per-platform macros.
#
\%_arch			$ARCH
\%_build_arch		$ARCH
\%_vendor		apple
\%_os			darwin
\%_gnu			%{nil}
\%_target_platform	%{_target_cpu}-%{_vendor}-%{_target_os}
\%optflags		-O2 $BITS

__EOF__
    done
    perl -pi -e "s/^\%_arch.*/\%_arch\t\t\tfat/g;s/^\%_build_arch.*/\%_build_arch\t\tfat/g" \
        /tmp/rpm-root/usr/local/lib/rpm/macros
    perl -pi -e "s/^(\%optflags)(\s+)(.*)/\$1\$2\$3 -arch i386 -arch ppc/g" \
        /tmp/rpm-root/usr/local/lib/rpm/macros

Basically I wanted to build 32-bit for i386/ppc and
64-bit for x86_64/ppc64, and default to "fat" arch
(which was i386 + ppc, probably x86_64 + i386 now ?)

Didn't use the -g flag, since brp-strip isn't enabled.
(rpm would normally/ELF put the debuginfo into separate
packages, and then strip debugging from the output...)

--anders
Received on Mon Mar 26 20:33:57 2012
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.