Subject: building graphics/xpm: help needed (shared libs etc.)
To: None <tech-pkg@netbsd.org>
From: Georg Schwarz <geos@epost.de>
List: tech-pkg
Date: 09/11/2004 23:47:18
Hi everyone,

I am trying to get graphics/xpm compile on IRIX 5.3. With the normal
imake procedure this unfortunately fails:

...
rm -f libXpm.a
/usr/bin/ar cq libXpm.a data.o create.o misc.o rgb.o scan.o parse.o
hashtab.o  CrBufFrI.o CrDatFrP.o CrPFrBuf.o RdFToI.o WrFFrI.o
CrBufFrP.o CrIFrBuf.o CrPFrDat.o RdFToP.o WrFFrP.o  CrDatFrI.o
CrIFrDat.o RdFToDat.o WrFFrDat.o  Attrib.o CrIFrP.o CrPFrI.o Image.o
Info.o RdFToBuf.o WrFFrBuf.o
bmake: $(_NULLCMD_) expands to empty string
bmake: $(_NULLCMD_) expands to empty string
rm -f libXpm.so4.11  && /usr/bin/ld -32  -no_unresolved -shared    -all
-update_registry $ROOT/usr/local/pkg/lib/so_locations -soname
libXpm.so4.11 -set_version sgi1.0 libXpm.a -o libXpm.so4.11 
/usr/bin/../lib/ld:
Cannot update file /usr/local/pkg/lib/so_locations; changing to
-check_registry
Unresolved:
__us_rsthread_stdio
__semgetc
__filbuf
ungetc
__ctype
malloc
strncpy
realloc
free
strncmp
strrchr
XParseColor
XAllocColor
calloc
abs
qsort
XUngrabServer
XGrabServer
XQueryColors
strcasecmp
XDefaultVisual
XDefaultScreen
XDefaultColormap
strcmp
XFreeColors
XDefaultDepth
XCreateImage
memset
fopen
fgets
sscanf
strlen
tolower
fclose
strdup
sprintf
strchr
strcpy
strcat
__iob
popen
pclose
fprintf
XGetGeometry
XGetImage
XCreatePixmap
XCreateGC
XPutImage
XFreeGC
open
fstat
close
fdopen
fread
fwrite
bmake: $(_NULLCMD_) expands to empty string
bmake: $(NOOP) expands to empty string
STR=4.11; if [ -n "${STR}" ]; then  cd ../usrlib && rm -f libXpm.so &&
ln -s libXpm.so4.11 libXpm.so;  fi
../usrlib: Does not exist
*** Error code 1

Stop.
bmake: stopped in
/usr/people/schwarz/pkgsrc/graphics/xpm/work/xpm-3.4k/lib
*** Error code 1

any idead why this fails?
 


Therefore I decided to try the non-imake way. I applied the following
patches (comments on my choice of install paths would be very welcome):


--- Makefile.orig       Sat Sep 11 18:41:31 2004
+++ Makefile    Sat Sep 11 23:06:26 2004
@@ -13,7 +13,25 @@
 PKG_INSTALLATION_TYPES=        overwrite pkgviews
 
 USE_BUILDLINK3=        yes
+
+.include "../../mk/bsd.prefs.mk"
+.if !empty(LOWER_OPSYS:Mirix5*)
+MAKEFILE=      Makefile.noX
+INSTALL_TARGET=        install install.man
+USE_X11=       yes
+MAKE_ENV+=             RM_CMD="${RM} -f"
+MAKE_ENV+=             MKDIRHIER="${MKDIR}"
+MAKE_ENV+=             LN="${LN}"
+_EXTRAMAKEFLAGS=       DESTBINDIR=${PREFIX}/bin
+_EXTRAMAKEFLAGS+=      MANDIR=${PREFIX}/man/manl
+_EXTRAMAKEFLAGS+=      DESTLIBDIR=${PREFIX}/lib
+_EXTRAMAKEFLAGS+=      DESTINCLUDEDIR=${PREFIX}/include/X11
+MAKE_ENV+=             EXTRAMAKEFLAGS="${_EXTRAMAKEFLAGS}"
+PLIST_SUBST+=          IMAKE_MAN_DIR=man/manl
+PLIST_SUBST+=          IMAKE_MANNEWSUFFIX=l
+.else
 USE_IMAKE=     # defined
+.endif
 
 CHECK_BUILTIN.xpm=     yes
 .include "builtin.mk"

--- work/xpm-3.4k/lib/Makefile.noX.orig Sat Sep 11 23:10:15 2004
+++ work/xpm-3.4k/lib/Makefile.noX      Sat Sep 11 23:11:20 2004
@@ -35,20 +35,20 @@
 DEFINES =
 
 # where the library will be installed
-DESTLIBDIR=/usr/local/lib/X11
+#DESTLIBDIR=/usr/local/lib/X11
 # where the include file (pxm.h) will be installed
-DESTINCLUDEDIR=/usr/local/include/X11
+#DESTINCLUDEDIR=/usr/local/include/X11
 
-CC = cc
+#CC = cc
 AR = ar r
-RANLIB = ranlib
-RM = rm -f
+#RANLIB = ranlib
+#RM = rm -f
 # on sysV, define this as cp.
-INSTALL = install -c
-MKDIRHIER = mkdir
-LN = ln -s
+#INSTALL = install -c
+#MKDIRHIER = mkdir
+#LN = ln -s
 
-CDEBUGFLAGS= -O
+#CDEBUGFLAGS= -O
 
 OBJS= data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \
       WrFFrP.o RdFToP.o CrPFrDat.o CrDatFrP.o \
--- work/xpm-3.4k/sxpm/Makefile.noX.orig        Sat Sep 11 23:10:50 2004
+++ work/xpm-3.4k/sxpm/Makefile.noX     Sat Sep 11 23:11:37 2004
@@ -28,9 +28,9 @@
 #
 
 # where the program will be installed
-DESTBINDIR=/usr/local/bin/X11
+#DESTBINDIR=/usr/local/bin/X11
 # where the man page will be installed
-MANDIR=/usr/local/man/manl
+#MANDIR=/usr/local/man/manl
 
 # where the X11 libs are
 XLIBDIRS= -L/usr/X11/lib
@@ -38,12 +38,12 @@
 LIBDIRS= -L../lib
 LIBS= -lXpm -lXext -lXt -lX11
 
-CC = cc
-RM = rm -f
+#CC = cc
+#RM = rm -f
 # on sysV, define this as cp.
-INSTALL = install -c
+#INSTALL = install -c
 
-CDEBUGFLAGS= -O
+#CDEBUGFLAGS= -O
 
 INCLUDES= -I..
 
--- work/xpm-3.4k/cxpm/Makefile.noX.orig        Sat Sep 11 23:10:41 2004
+++ work/xpm-3.4k/cxpm/Makefile.noX     Sat Sep 11 23:11:31 2004
@@ -28,16 +28,16 @@
 #
 
 # where the program will be installed
-DESTBINDIR=/usr/local/bin/X11
+#DESTBINDIR=/usr/local/bin/X11
 # where the man page will be installed
-MANDIR=/usr/local/man/manl
+#MANDIR=/usr/local/man/manl
 
-CC = cc
-RM = rm -f
+#CC = cc
+#RM = rm -f
 # on sysV, define this as cp.
-INSTALL = install -c
+#INSTALL = install -c
 
-CDEBUGFLAGS= -O
+#CDEBUGFLAGS= -O
 
 INCLUDES= -I..
 
--- work/xpm-3.4k/Makefile.noX.orig     Sat Sep 11 23:10:05 2004
+++ work/xpm-3.4k/Makefile.noX  Sat Sep 11 23:11:06 2004
@@ -32,9 +32,9 @@
 
 SUBDIRS= lib sxpm cxpm
 
-MAKE=make
-MFLAGS=-f Makefile.noX
-INSTALL= install -c
+#MAKE=make
+MFLAGS= -f Makefile.noX MKDIRHIER="$(MKDIRHIER)" LN="$(LN) -s"
RM="$(RM_CMD)" CDEBUGFLAGS="$(CFLAGS)" $(EXTRAMAKEFLAGS)
+#INSTALL= install -c
 CURRENT_DIR=.
 
 all::


Now bmake install almost works:

....
===> [Automatic none shared object handling]
UX:ls: ERROR: Cannot access /usr/local/pkg/lib/libXpm.so: No such file
or directory
UX:ls: ERROR: Cannot access /usr/local/pkg/lib/libXpm.so.4: No such file
or directory
UX:ls: ERROR: Cannot access /usr/local/pkg/lib/libXpm.so.4.11: No such
file or directory
===> Registering installation for xpm-3.4knb1
pkg_create: can't stat `/usr/local/pkg/lib/libXpm.so'
pkg_create: can't stat `/usr/local/pkg/lib/libXpm.so.4'
pkg_create: can't stat `/usr/local/pkg/lib/libXpm.so.4.11'
lorenz 205% 

This is because the shared libs have not been built. What is the best
way to build them? using libtool maybe? Can they be built from libXpm.a?

The binaries (in /usr/local/pkg/bin) are installed unstripped. Would it
be a good idea to have them stripped? And if so, what would be the
preferred way to accomplish that? Should I maybe not use the standard
install (of Makefile.noX) at all?


-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 geos@epost.de     +49 177 8811442