Subject: Re: Problems with 2006Q3
To: None <pkgsrc-users@netbsd.org>
From: Hrvoje =?utf-8?q?Habjani=C4=87?= <hrvoje.habjanic@zg.t-com.hr>
List: pkgsrc-users
Date: 11/02/2006 10:43:33
--Boundary-00=_F3bSFwtKpK6o04n
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Thursday 02 November 2006 09:53, Hrvoje Habjani=C4=87 wrote:
[snip]
>
> Few patches follow.
>

1. wrapper-sink-osf1.patch=20
Ld on Tru64 doesn't know what to do with "-h <soname>" flag, but it=20
understands "-soname" flag. This patch "fix"es this.

2. wrapper-buildcmd.patch
This one is my favorite. In short, Tru64 doent't have strict policy to=20
put "imported" libraries in /usr/local or something similar. They all end u=
p=20
in default places. This include libraries like libjpeg and libz. Of course,=
=20
those installed in default location are some quite old versions, custom mad=
e,=20
needed for normal os operation (gui administration tools). Of course, ld=20
linker first searches default places, and then if it doesn't found library,=
=20
it searches for it in directories listed in "-L" flags.
So, i needed a way to modify linker search order to succesufuly compile net=
pbm=20
package. For Tru 64 ld, to disable default search path, one must include "-=
L"=20
empty option on command line. Of course, wrapper libraries doesn't allow=20
this - then concatenate anything that comes after "-L"<space>. Instead of=20
complicating with regular expressions, i introduced new flag "-no-std-libs"=
,=20
which bypasses sink wrappers (and others). This, probably, can be done=20
better, but it works for me - all that needs to be done is to put this flag=
=20
in LDFLAGS directive in mk.conf.

3. mk.conf settings
=46ollowing needs to be "added" to mk.conf file:
CC=3D                             gcc
CFLAGS+=3D                        -D__arch64__
CXX=3D                            g++
CXXFLAGS+=3D                      -D__arch64__
# custom header to remove default libs
LDFLAGS+=3D                       -no-std-libs

"-D__arch64__" is needed because of broken headers on Tru64 - by default th=
ey=20
include int64 but not uint64. If you add this flag, then uint64 gets includ=
ed=20
too.

4. unzip package
Authors recently made some changes to crc32.c file, and they broke building=
 of=20
unzipsfx. The problem is that make is first compiling crc32.c for unzip=20
command with USE_ZLIB flag enabled, and later it reuses it form unzipsfx. B=
ut=20
that's wrong, because crc32 for unzipsfx must not have USE_ZLIB defined,=20
because unzipsfx doesn't use zlib!! So you get unresolved references ...
Patch fixes this ...

5. png package
Again, authors assume too much. My os doesn't have gnu malloc. :-) But this=
 is=20
requirement for this package, as can be seen in configure.ac. Unfortunately=
,=20
authors doesn't provide replacement, so you end up with unresolved=20
rpl_malloc. Quick fix was to remove this requirement, but more permanent=20
solution would be to rpl_malloc be defined somewhere within libpng. I did=20
quick-and-dirty fix. :-)

6. netpbm-misc.patch
This one is big. In short, Tru64 has probably broken snadards.h. Instead of=
=20
fixing system include file (which could broke a lot of things), i added few=
=20
#ifdefs in netpbm source files.

NOTE: i did update from cvs on 26.10.2006.

H.

--Boundary-00=_F3bSFwtKpK6o04n
Content-Type: text/x-diff;
  charset="utf-8";
  name="wrapper-sink-osf1.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="wrapper-sink-osf1.patch"

--- mk/wrapper/cmd-sink-osf1-cc.orig	Sun Oct 29 01:47:48 2006
+++ mk/wrapper/cmd-sink-osf1-cc	Mon Oct 30 13:21:31 2006
@@ -34,6 +34,11 @@
 		esac
 		$debug_log $wrapperlog "    (cmd-sink-osf1-cc) drop: $dir [adding to osf1runpath]"
 		;;
+	-Wl,-h*)
+		arg="-Wl,-soname"${arg#"-Wl,-h"}
+		$debug_log $wrapperlog "    (cmd-sink-osf1-cc) pop: $arg"
+		. $buildcmd
+		;;
 	*)
 		. $buildcmd
 		;;
--- mk/wrapper/cmd-sink-osf1-ld.orig	Sat Oct 28 19:24:31 2006
+++ mk/wrapper/cmd-sink-osf1-ld	Sun Oct 29 20:36:08 2006
@@ -33,6 +33,11 @@
 		esac
 		$debug_log $wrapperlog "    (cmd-sink-osf1-ld) drop: $dir [adding to osf1runpath]"
 		;;
+	-Wl,-h,*)
+		arg="-Wl,-soname"${arg#"-Wl,-h"}
+		$debug_log $wrapperlog "    (cmd-sink-osf1-ld) pop: $arg"
+		. $buildcmd
+		;;
 	-pthread)
 		arg="-lpthread"
 		$debug_log $wrapperlog "    (cmd-sink-osf1-ld) pop: $arg"

--Boundary-00=_F3bSFwtKpK6o04n
Content-Type: text/x-diff;
  charset="utf-8";
  name="wrapper-buildcmd.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="wrapper-buildcmd.patch"

--- mk/wrapper/buildcmd.orig	Mon Oct 30 14:10:57 2006
+++ mk/wrapper/buildcmd	Mon Oct 30 21:12:17 2006
@@ -40,6 +40,9 @@
 ######################################################################
 "")
 	;;
+-no-std-libs)
+	libs="-L -L/usr/shlib $libs"
+	;;
 ######################################################################
 # Reduce command length by not appending options that we've already
 # seen.  We also ensure that all of the -l options come after the -L

--Boundary-00=_F3bSFwtKpK6o04n
Content-Type: text/x-diff;
  charset="utf-8";
  name="png-gmalloc.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="png-gmalloc.patch"

--- configure.ac.orig	Sun Oct 29 18:30:25 2006
+++ configure.ac	Sun Oct 29 18:30:44 2006
@@ -52,7 +52,7 @@
 AC_STRUCT_TM
 
 # Checks for library functions.
-AC_FUNC_MALLOC
+#AC_FUNC_MALLOC
 AC_FUNC_STRTOD
 AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
 AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
--- configure.orig	Sun Oct 29 18:37:05 2006
+++ configure	Sun Oct 29 18:37:52 2006
@@ -19451,84 +19451,6 @@
 
 done
 
-echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
-echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
-if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_malloc_0_nonnull=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#if STDC_HEADERS || HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-char *malloc ();
-#endif
-
-int
-main ()
-{
-exit (malloc (0) ? 0 : 1);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_malloc_0_nonnull=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_malloc_0_nonnull=no
-fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
-echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
-if test $ac_cv_func_malloc_0_nonnull = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MALLOC 1
-_ACEOF
-
-else
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_MALLOC 0
-_ACEOF
-
-   case $LIBOBJS in
-    "malloc.$ac_objext"   | \
-  *" malloc.$ac_objext"   | \
-    "malloc.$ac_objext "* | \
-  *" malloc.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
-esac
-
-
-cat >>confdefs.h <<\_ACEOF
-#define malloc rpl_malloc
-_ACEOF
-
-fi
 
 
 

--Boundary-00=_F3bSFwtKpK6o04n
Content-Type: text/x-diff;
  charset="utf-8";
  name="netpbm-misc.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="netpbm-misc.patch"

--- converter/other/jpeg2000/pamtojpeg2k.c.orig	Tue Oct 31 09:41:12 2006
+++ converter/other/jpeg2000/pamtojpeg2k.c	Tue Oct 31 10:53:02 2006
@@ -9,7 +9,11 @@
 *****************************************************************************/
 
 #define _BSD_SOURCE 1    /* Make sure strdup() is in string.h */
+#ifdef __osf__
+#define _OSF_SOURCE
+#else
 #define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
+#endif /* __osf__ */
 #include <string.h>
 
 #include "pam.h"
--- converter/other/jpeg2000/jpeg2ktopam.c.orig	Tue Oct 31 09:41:56 2006
+++ converter/other/jpeg2000/jpeg2ktopam.c	Tue Oct 31 10:52:39 2006
@@ -9,7 +9,11 @@
 *****************************************************************************/
 
 #define _BSD_SOURCE 1      /* Make sure strdup() is in string.h */
+#ifdef __osf__
+#define _OSF_SOURCE
+#else
 #define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
+#endif /* __osf__ */
 #include <string.h>
 
 #include "pam.h"
--- converter/other/cameratopam/camera.c.orig	Tue Oct 31 09:49:45 2006
+++ converter/other/cameratopam/camera.c	Tue Oct 31 10:55:38 2006
@@ -1,7 +1,11 @@
 #define _BSD_SOURCE
     /* Make sure strcasecmp is in string.h */
+#ifdef __osf__
+#define _OSF_SOURCE
+#else
 #define _XOPEN_SOURCE
     /* Make sure putenv is in stdlib.h */
+#endif /* __osf__ */
 #define __EXTENSIONS__
 
 #include <stdlib.h>
--- converter/other/cameratopam/cameratopam.c.orig	Tue Oct 31 09:55:51 2006
+++ converter/other/cameratopam/cameratopam.c	Tue Oct 31 10:55:17 2006
@@ -18,7 +18,11 @@
 */
 #include <time.h>
 
+#ifdef __osf__
+#define _OSF_SOURCE
+#else
 #define _XOPEN_SOURCE  /* Make sure unistd.h contains swab() */
+#endif /* __osf__ */
 
 #include <ctype.h>
 #include <unistd.h>

--Boundary-00=_F3bSFwtKpK6o04n
Content-Type: text/x-diff;
  charset="utf-8";
  name="unzip-crc32.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="unzip-crc32.patch"

--- unix/Makefile.orig	Mon Oct 30 22:45:35 2006
+++ unix/Makefile	Mon Oct 30 22:48:02 2006
@@ -87,7 +87,7 @@
 OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
 LOBJS = $(OBJS)
 OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
-OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
+OBJX = unzipsfx$O crc32_$O crctab_$O crypt_$O extract_$O fileio_$O \
 	globals_$O inflate_$O match_$O process_$O ttyio_$O $M_$O
 LOBJX = $(OBJX)
 OBJF = funzip$O $(CRC32)$O cryptf$O globalsf$O inflatef$O ttyiof$O
@@ -306,6 +306,11 @@
 	-$(CP) unzip.c unzipsfx.c
 	$(CC) -c $(CF) -DSFX unzipsfx.c
 	$(RM) unzipsfx.c
+
+crc32_$O:	crc32.c $(UNZIP_H) zip.h			# unzipsfx only
+	-$(CP) crc32.c crc32_.c
+	$(CC) -c $(CF) -DSFX crc32_.c
+	$(RM) crc32_.c
 
 crctab_$O:	crctab.c $(UNZIP_H) zip.h
 	-$(CP) crctab.c crctab_.c

--Boundary-00=_F3bSFwtKpK6o04n--