Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 74101 - netpbm can be used on ppc-macos
Summary: netpbm can be used on ppc-macos
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Mac OSX (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: Gentoo for Mac OS X
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-11 07:13 UTC by Johan Hattne
Modified: 2007-10-09 07:31 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Altered ebuild (netpbm-10.20.ebuild,2.51 KB, application/octet-stream)
2005-03-20 13:32 UTC, Benjamin Braatz
Details
Patch to the ebuild (netpbm-10.20.ebuild.diff,1.92 KB, patch)
2005-03-20 13:33 UTC, Benjamin Braatz
Details | Diff
Patch applied by the new ebuild (macos.patch,2.73 KB, patch)
2005-03-20 13:34 UTC, Benjamin Braatz
Details | Diff
changed patch that allows anytopnm to run correctly (netpbm-10.28-darwin.patch,2.77 KB, patch)
2005-08-13 07:42 UTC, Fabian Groffen
Details | Diff
A slightly different ebuild patch for netpbm-10.28 (ebuild.patch,1.64 KB, patch)
2005-08-13 07:46 UTC, Fabian Groffen
Details | Diff
improved netpbm-10.28 darwin patch (netpbm-10.28-darwin.patch,2.89 KB, patch)
2005-08-13 12:41 UTC, Fabian Groffen
Details | Diff
improved changes made to the netpbm-10.28 ebuild (ebuild.patch,2.45 KB, patch)
2005-08-14 10:23 UTC, Fabian Groffen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Hattne 2004-12-11 07:13:24 UTC
In order to build netpbm, the following lines need to be added to src_unpack of the ebuild (only ppc-macos):

  echo "DEFAULT_TARGET  = nonmerge"           >> Makefile.config
  echo "NETPBMLIBTYPE   = dylib"              >> Makefile.config
  echo "NETPBMLIBSUFFIX = dylib"              >> Makefile.config
  echo "STATICLIB_TOO   = n"                  >> Makefile.config
  echo "NETPBMLIB_RUNTIME_PATH ="             >> Makefile.config
  echo "CC              = cc -no-cpp-precomp" >> Makefile.config
  echo "CFLAGS_SHLIB    = -fno-common"        >> Makefile.config
  echo "LDSHLIB         = -dynamiclib -install_name $(NETPBM_RUNTIME_PATH)/libnetpbm.$(MAJ).dylib" >> Makefile.config
  echo "TIFFLIB         = libtiff.dylib"      >> Makefile.config
  echo "JPEGLIB         = libjpeg.dylib"      >> Makefile.config
  echo "PNGLIB          = libpng.dylib"       >> Makefile.config
  echo "ZLIB            = libz.dylib"         >> Makefile.config
  echo "NETPBM_DOCURL   = http://netpbm.sourceforge.net/doc/" >> Makefile.config

Actually, not all of them are really necessary.  The linking issue at src_install should be addressed as well.  transfig and xfig will build and install without any problem.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




Tested on Mac OS X 10.3.6
Comment 1 Lina Pezzella (RETIRED) gentoo-dev 2004-12-11 08:53:45 UTC
Please make a makefile.config patch instead. There is no reason to clutter the ebuild with all those extra ppc-macos-only lines.
Comment 2 Johan Hattne 2004-12-13 07:50:15 UTC
Patch for Makefile.config below.  The symlink issue is not addressed.


--- Makefile.config     Sun Nov  2 17:48:58 2003
+++ Makefile.config     Mon Dec 13 15:01:28 2004
@@ -1,3 +1,7 @@
+####This file was automatically created by 'configure.'
+####Many variables are set twice -- a generic setting, then 
+####a system-specific override at the bottom of the file.
+####
 # This is a make file inclusion, to be included in all the Netpbm make
 # files.
 
@@ -526,3 +530,22 @@
 NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/
 #For a system with no web access, but a local copy of the doc:
 #NETPBM_DOCURL = file:/usr/doc/netpbm/
+
+
+
+
+####Lines above were copied from Makefile.config.in by 'configure'.
+####Lines below were added by 'configure' based on the DARWIN platform.
+DEFAULT_TARGET = nonmerge
+NETPBMLIBTYPE=dylib
+NETPBMLIBSUFFIX=dylib
+STATICLIB_TOO=n
+NETPBMLIB_RUNTIME_PATH=
+CC = cc -no-cpp-precomp
+CFLAGS_SHLIB = -fno-common
+LDSHLIB = -dynamiclib -install_name $(NETPBM_RUNTIME_PATH)/libnetpbm.$(MAJ).dylib
+TIFFLIB = libtiff.dylib
+JPEGLIB = libjpeg.dylib
+PNGLIB = libpng.dylib
+ZLIB = libz.dylib
+NETPBM_DOCURL = http://netpbm.sourceforge.net/doc/
Comment 3 Benjamin Braatz 2005-03-20 13:32:12 UTC
Created attachment 53981 [details]
Altered ebuild
Comment 4 Benjamin Braatz 2005-03-20 13:33:09 UTC
Created attachment 53982 [details, diff]
Patch to the ebuild
Comment 5 Benjamin Braatz 2005-03-20 13:34:07 UTC
Created attachment 53983 [details, diff]
Patch applied by the new ebuild
Comment 6 Benjamin Braatz 2005-03-20 13:40:04 UTC
I second that these packages work under ppc-macos. As the original reporter said, transfig and xfig work without modifications, but for netpbm I've just added some alternative patches taking care of the linking issue and handling the imported libraries (TIFFLIB, JPEGLIB, etc.) on a per USE-flag-basis as the original ebuild did it.

This is somehow ugly, perhaps some more experienced and less occupied person than me should eventually invent a method for ebuilds to take care of the different suffixes for different systems, which solves this more elegantally.
Comment 7 Fabian Groffen gentoo-dev 2005-06-15 12:15:34 UTC
In order to get transfig compiling on OS X Tiger GCC 4.0 I had to apply some
patches.  A description of my findings can be read in this bug on transfig on
GCC 4.0: http://bugs.gentoo.org/show_bug.cgi?id=80760
Comment 8 Fabian Groffen gentoo-dev 2005-06-16 12:48:38 UTC
transfig doesn't build on Panther, because panther seems not to be equipped with
xmkmf, which Tiger apparently is.  I could not find an ebuild with provides
xmkmf... :/
Comment 9 Fabian Groffen gentoo-dev 2005-08-13 03:06:56 UTC
xmkmf is provided by X11, so my previous comment was nonsense.
Comment 10 Fabian Groffen gentoo-dev 2005-08-13 03:18:57 UTC
this bug actually is only about netpbm.  transfig and xfig should have their own
separate bugs.  Transfig is already covered by bug #80760, xfig appears not yet
to be in bugzilla
Comment 11 Fabian Groffen gentoo-dev 2005-08-13 07:12:16 UTC
When installed I get this indicating all linking is not completely ok:

% anytopnm Fantasy\ Art/stawicki-dragon\'s\ lair.jpg  
dyld: Library not loaded: /libnetpbm.10.dynlib
  Referenced from: /usr/bin/jpegtopnm
  Reason: image not found
/usr/bin/anytopnm: line 555:  5860 Trace/BPT trap          jpegtopnm "$file"

Comment 12 Fabian Groffen gentoo-dev 2005-08-13 07:42:50 UTC
Created attachment 65844 [details, diff]
changed patch that allows anytopnm to run correctly

this patch differs from the previous that (apart from some fuzzyness fixing) it
does not specify the install name for the libnetpbm library (was called dynlib
also by the way!!!!) and as such allows anytopnm (jpegtopng actually) to run on
my Mac.
Comment 13 Fabian Groffen gentoo-dev 2005-08-13 07:46:37 UTC
Created attachment 65845 [details, diff]
A slightly different ebuild patch for netpbm-10.28

I felt it was cleaner to avoid the many if/then/elses and just do a sed
's/\.so/.dylib/g' afterwards.  It doesn't change anything it shouldn't, so it
lookes nicer to me.  Also used userland_Darwin because this is all darwin
linker stuff.

Can someone test if this ebuild + patch work like expected?  I did some simple
test with anytopnm on a file to see if it would convert.
Comment 14 Fabian Groffen gentoo-dev 2005-08-13 12:41:50 UTC
Created attachment 65869 [details, diff]
improved netpbm-10.28 darwin patch

Implemented suggestion/complaint by kito that the linker should be called with
-install_name, which I commented out in my previous patch.  This initially went
wrong because it used the variable $(NETPBM_RUNTIME_PATH) which was unset
lateron in the file.  Enabling this variable lead to the compilation script
thinking it was clever and pulling -rpath on the (Apple) linker, which on its
turn complained it didn't know what the hack that was supposed to mean.

So, to fix a dirty config file, the dirty way, I just copied the value of
$(NETPBM_RUNTIME_PATH) and substituted/hardcoded it in LDSHLIB.  Rationale: the
path was set the hard way in the script anyway, and by leaving the
$(NETPBM_RUNTIME_PATH) variable unset, the rest of the compilation went find. 
Now the binaries also seem to be happy with this, so I think it nears
'perfection'... ahem.

I'd still love someone to test this once before thinking of contacting the
maintainer and/or committing to CVS.
Comment 15 Hasan Khalil (RETIRED) gentoo-dev 2005-08-13 12:44:39 UTC
Latest patches worked like a charm with all USE flags enabled (except svga, which is masked anyhow).
Comment 16 Lina Pezzella (RETIRED) gentoo-dev 2005-08-13 13:35:03 UTC
Make sure you submit this upstream please. :-)
Comment 17 Fabian Groffen gentoo-dev 2005-08-13 13:39:31 UTC
I doubt that.  Looking through their perl configure script (yes another package)
it seems they are aware of Darwin/OSX.  The ebuild does not  use this configure
script because it is an interactive perl script that requires input from the
user on questions, hence impossible to script.  What we basically do is hack out
way to generate the same file as the configure script would do, using our ebuild. :(
Comment 18 Fabian Groffen gentoo-dev 2005-08-14 10:23:28 UTC
Created attachment 65946 [details, diff]
improved changes made to the netpbm-10.28 ebuild

It took some time and efforts after a comment by lu_zero that the symlinking of
the library in the previous ebuild was a conditional for userland_Darwin.  It
appeared that kito already made the right tools for this in multilib, hence I
rewrote the ebuild to use the multilib functions $(get_libdir) and
$(get_libname).  Initially this caused pulling some nose hair, as it seems that
$(get_libname) does not work if eutils is inherited (which should inherit
multilib on its turn).	It seems eutils is pulled as a dependency because its
functionality is available even though it is not inherited explicitly.	This IS
needed however to get multilib doing what it is supposed to do.

Result is a much cleaner ebuild, IMHO.
Comment 19 Dirk Schoenberger 2005-10-04 12:13:41 UTC
while trying to emerge netpbm-10.29-r1 I run into the following problem

>>> Unpacking source...
>>> Unpacking netpbm-10.29.tgz to /var/tmp/portage/netpbm-10.29-r1/work
>>> Unpacking netpbm-10.29-manpages.tar.bz2 to /var/tmp/portage/netpbm-10.29-r1/work
 * Applying netpbm-10.29-anytopnm.patch ...                               [ ok ]
 * Applying netpbm-10.29-pnmtopng-alpha-check.patch ...                   [ ok ]
 * Applying netpbm-10.29-build.patch ...                                  [ ok ]
>>> Source unpacked.
make -C lib/ -f /private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29//lib/Makefile \
    SRCDIR=/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29 BUILDDIR=/private/var/
tmp/portage/netpbm-10.29-r1/work/netpbm-10.29 all 
make -C /private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/ pm_config.h
make -C /private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/buildtools/ -f /private/
var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/buildtools/Makefile \
    SRCDIR=/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29 BUILDDIR=/private/var/
tmp/portage/netpbm-10.29-r1/work/netpbm-10.29 typegen 
c -o typegen.o typegen.c
make[3]: c: Command not found
make[3]: [typegen.o] Error 127 (ignored)
gcc -o typegen typegen.o
powerpc-apple-darwin8-gcc-4.0.0: typegen.o: No such file or directory
powerpc-apple-darwin8-gcc-4.0.0: no input files
make[3]: *** [typegen] Error 1
Comment 20 Dirk Schoenberger 2005-10-04 12:53:37 UTC
> while trying to emerge netpbm-10.29-r1 I run into the following problem

The problem root seems to be that the 10.29-r1.ebuild uses some elements which may lead to 
problems with my build system, namely the following variables

        CC = $(tc-getCC)
        CC_FOR_BUILD = $(tc-getBUILD_CC)
        AR = $(tc-getAR)
        RANLIB = $(tc-getRANLIB)

If I replace these by the "classic values", as in 

        CC = gcc
        CC_FOR_BUILD = gcc
        AR = ar
        RANLIB = ranlib

the package compiles, but it leaves an issue with -shared

gcc -c -I/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/lib -I. -DNDEBUG -O2 -
pipe -fPIC \
    -o libsystem.o libsystem.c
gcc -shared -Wl,-soname,libnetpbm.so.10 -o libnetpbm.so.10.29 libpm.o fileio.o bitio.o colorname.o 
libpbm1.o libpbm2.o libpbm3.o libpbmfont.o libpgm1.o libpgm2.o libppm1.o libppm2.o libppmcmap.o 
libppmcolor.o libppmd.o ppmdfont.o standardppmdfont.o libppmfloyd.o libpnm1.o libpnm2.o 
libpnm3.o libpam.o libpamread.o libpamwrite.o libpamn.o libpammap.o libpamcolor.o libsystem.o util/
shhopt.o util/nstring.o \
           
rm -f libnetpbm.a
powerpc-apple-darwin8-gcc-4.0.0: unrecognized option '-shared'
ar rc libnetpbm.a libpm.o fileio.o bitio.o colorname.o libpbm1.o libpbm2.o libpbm3.o libpbmfont.o 
libpgm1.o libpgm2.o libppm1.o libppm2.o libppmcmap.o libppmcolor.o libppmd.o ppmdfont.o 
standardppmdfont.o libppmfloyd.o libpnm1.o libpnm2.o libpnm3.o libpam.o libpamread.o 
libpamwrite.o libpamn.o libpammap.o libpamcolor.o libsystem.o util/shhopt.o util/nstring.o
/usr/bin/ld: unknown flag: -soname
Comment 21 Fabian Groffen gentoo-dev 2005-10-04 12:59:12 UTC
that would imply the toolchain-funcs eclass doesn't handle ppc-macos correctly?

Dirk, what is the current value of CHOST in /etc/make.conf for you?
Comment 22 Dirk Schoenberger 2005-10-04 13:03:26 UTC
> Dirk, what is the current value of CHOST in /etc/make.conf for you?

CHOST="powerpc-apple-darwin"
Comment 23 Fabian Groffen gentoo-dev 2005-10-04 13:08:39 UTC
if on Tiger you should change that into
CHOST="powerpc-apple-darwin8"

but it seems to me one of the functions from the eclass doesn't return what it
should.  The ebuild is not darwinised too, since it uses hardcoded .so, so that
won't ever work too.  Then the shared issue is just another thing to fix.
Comment 24 Dirk Schoenberger 2005-10-04 13:23:55 UTC
> if on Tiger you should change that into
> CHOST="powerpc-apple-darwin8"
Done

> but it seems to me one of the functions from the eclass doesn't return what it
> should.  The ebuild is not darwinised too, since it uses hardcoded .so, so that
> won't ever work too.  Then the shared issue is just another thing to fix.

Should I upgrade to a new portage? I run on 2.0.52-r1, current is portage-2.0.53_rc3 (but as usual it 
doesn't emerge cleanly because of already existing files)
Comment 25 Fabian Groffen gentoo-dev 2005-10-04 13:35:34 UTC
you should reemerge system:
emerge -eva system

portage 2.0.53 is still in ~ppc-macos

back to this bug.  I'm going to look into this later.  I patched it before, as
in this bug in the attached patch, but I want the patch to become unconditional,
so I have te see if I can do it from the ebuild a bit more cleanly.  (Also
conditional, but just not as patch...)
Comment 26 SpanKY gentoo-dev 2005-10-04 16:20:19 UTC
sync up and try latest 10.29-r1
Comment 27 Fabian Groffen gentoo-dev 2005-10-05 07:39:06 UTC
unfortunately need media-libs/jasper first.
Comment 28 Fabian Groffen gentoo-dev 2005-10-05 07:45:40 UTC
got jasper, no luck:

make -C /private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/buildtools/
-f /private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/buildtools/Makefile \
    SRCDIR=/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29
BUILDDIR=/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29 typegen 
c -o typegen.o typegen.c
make[3]: c: Command not found
make[3]: [typegen.o] Error 127 (ignored)
gcc -o typegen typegen.o
powerpc-apple-darwin8-gcc-4.0.0: typegen.o: No such file or directory
powerpc-apple-darwin8-gcc-4.0.0: no input files
make[3]: *** [typegen] Error 1
make[2]: ***
[/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/buildtools/typegen]
Error 2
make[1]: ***
[/private/var/tmp/portage/netpbm-10.29-r1/work/netpbm-10.29/pm_config.h] Error 2
make: *** [lib/all] Error 2
Comment 29 Fabian Groffen gentoo-dev 2005-10-05 08:15:21 UTC
| # Gentoo toolchain options
| CC = gcc
| CC_FOR_BUILD =
| AR = ar
| RANLIB = ranlib
| STRIPFLAG =
| CFLAGS_SHLIB = -fPIC
| 
| NETPBMLIBTYPE = dylib
| NETPBMLIBSUFFIX = dylib
| LDSHLIB = -dynamiclib -install_name $(SONAME)

on linux this looks like:
| CC = i686-pc-linux-gnu-gcc
| CC_FOR_BUILD = i686-pc-linux-gnu-gcc
| AR = i686-pc-linux-gnu-ar
| RANLIB = i686-pc-linux-gnu-ranlib
| STRIPFLAG =
| CFLAGS_SHLIB = -fPIC

so it's figuring out why the eclass doesn't work well on OSX/Darwin
Comment 30 SpanKY gentoo-dev 2005-10-05 09:25:33 UTC
hrm, i thought i fixed that

see if updating toolchain-funcs.eclass tc-getBUILD_CC() works ... add this line
before the last 'export BUILD_CC':

search=${search:-gcc}
Comment 31 Fabian Groffen gentoo-dev 2005-10-05 11:16:14 UTC
that seems to do the trick at least to get into compilation stage for me.

I now have:
| # Gentoo toolchain options
| CC = gcc
| CC_FOR_BUILD = gcc
| AR = ar
| RANLIB = ranlib
| STRIPFLAG =
| CFLAGS_SHLIB = -fPIC

and need to deal with the following linking error:
rm -f libnetpbm.a
ar rc libnetpbm.a libpm.o fileio.o bitio.o colorname.o libpbm1.o libpbm2.o
libpbm3.o libpbmfont.o libpgm1.o libpgm2.o libppm1.o libppm2.o libppmcmap.o
libppmcolor.o libppmd.o ppmdfont.o standardppmdfont.o libppmfloyd.o libpnm1.o
libpnm2.o libpnm3.o libpam.o libpamread.o libpamwrite.o libpamn.o libpammap.o
libpamcolor.o libsystem.o util/shhopt.o util/nstring.o
ranlib libnetpbm.a
ld: common symbols not allowed with MH_DYLIB output format with the
-multi_module option
libpm.o definition of common _pm_plain_output (size 4)
/usr/bin/libtool: internal link edit command failed
make[1]: *** [libnetpbm.10.29.dylib] Error 1
make: *** [lib/all] Error 2
Comment 32 Kito (RETIRED) gentoo-dev 2005-10-05 13:29:52 UTC
(In reply to comment #31)

> rm -f libnetpbm.a
> ar rc libnetpbm.a libpm.o fileio.o bitio.o colorname.o libpbm1.o libpbm2.o
> libpbm3.o libpbmfont.o libpgm1.o libpgm2.o libppm1.o libppm2.o libppmcmap.o
> libppmcolor.o libppmd.o ppmdfont.o standardppmdfont.o libppmfloyd.o libpnm1.o
> libpnm2.o libpnm3.o libpam.o libpamread.o libpamwrite.o libpamn.o libpammap.o
> libpamcolor.o libsystem.o util/shhopt.o util/nstring.o
> ranlib libnetpbm.a
> ld: common symbols not allowed with MH_DYLIB output format with the
> -multi_module option
> libpm.o definition of common _pm_plain_output (size 4)
> /usr/bin/libtool: internal link edit command failed
> make[1]: *** [libnetpbm.10.29.dylib] Error 1
> make: *** [lib/all] Error 2
> 

Not sure why it would be an MH_DYLIB when its trying to create a static archive... can try adding -fno-
common to CFLAGS or changing -multi_module to -single_module, but something else doesn't sound 
right...
Comment 33 SpanKY gentoo-dev 2005-10-05 18:53:05 UTC
ok, fixed the BUILD_CC func in toolchain-funcs.eclass
Comment 34 Fabian Groffen gentoo-dev 2006-02-21 13:00:39 UTC
ok, I gave this one a fling again.

% anytopnm 83.jpg
dyld: Library not loaded: libnetpbm.dylib.10
  Referenced from: /usr/bin/jpegtopnm
  Reason: image not found

this is obvious, as it should point to libnetpbm.10.dylib instead (which indeed exists).

It's not so obvious to me as how to get that corrected.
Comment 35 Elias Pipping (RETIRED) gentoo-dev 2007-10-08 22:13:20 UTC
netpbm is in the tree and keyworded ~ppc-macos, ~x86-macos.

this bug can be closed.
Comment 36 Fabian Groffen gentoo-dev 2007-10-09 07:31:22 UTC
please use prefix.