[PATCH] build system for NetBSD


Subject: [PATCH] build system for NetBSD
From: Johnny C. Lam (lamj@stat.cmu.edu)
Date: Tue Feb 29 2000 - 11:38:39 CST


The following adds support for building under NetBSD. The patch is
relative to the abi-0.7.8 source tree. Please consider its inclusion
for the next release of AbiWord.

        Cheers,

     -- Johnny C. Lam <lamj@stat.cmu.edu>
        Department of Statistics, Carnegie Mellon University
        http://www.stat.cmu.edu/~lamj/

--- src/config/abi_defs.mk.orig Tue Jan 11 06:46:50 2000
+++ src/config/abi_defs.mk Tue Feb 29 12:05:03 2000
@@ -353,14 +353,18 @@
 
 ifeq ($(ABI_NATIVE),unix)
 ifdef ABI_OPT_GNOME
-CFLAGS += `$(GNOME_CONFIG) --cflags gnorba gnomeui` -DHAVE_GNOME
-EXTRA_LIBS += `$(GNOME_CONFIG) --libs gnorba gnomeui`
+GNOME_CFLAGS := $(shell $(GNOME_CONFIG) --cflags gnorba gnomeui)
+GNOME_LIBS := $(shell $(GNOME_CONFIG) --libs gnorba gnomeui)
+CFLAGS += $(GNOME_CFLAGS) -DHAVE_GNOME
+EXTRA_LIBS += $(GNOME_LIBS)
 ABI_GNOME_DIR = gnome
 ABI_GNOME_PREFIX = Gnome
 ABI_OPTIONS+=Gnome:On
 else
-CFLAGS += `$(GTK_CONFIG) --cflags`
-EXTRA_LIBS += `$(GTK_CONFIG) --libs`
+GTK_CFLAGS := $(shell $(GTK_CONFIG) --cflags)
+GTK_LIBS := $(shell $(GTK_CONFIG) --libs)
+CFLAGS += $(GTK_CFLAGS)
+EXTRA_LIBS += $(GTK_LIBS)
 ABI_OPTIONS+=Gnome:Off
 endif
 endif
--- src/config/platforms/netbsd.mk.orig Sun Dec 12 10:07:09 1999
+++ src/config/platforms/netbsd.mk Tue Feb 29 12:05:03 2000
@@ -30,8 +30,13 @@
 ## compiler/loader options are used. It will probably also be used
 ## in constructing the name object file destination directory.
 
-OS_ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ | sed "s/\//-/")
+OS_ARCH := $(shell uname -m)
+
+ifneq (,$(shell $(CC) -E - -dM </usr/include/machine/endian.h | grep BYTE_ORDER.*LITTLE_ENDIAN))
 OS_ENDIAN = LittleEndian32
+else
+OS_ENDIAN = BigEndian32
+endif
 
 # Define tools
 CC = gcc
@@ -65,17 +70,20 @@
 endif
 
 # Includes
-OS_INCLUDES =
+OS_INCLUDES +=
 G++INCLUDES = -I/usr/include/g++
 
 # Compiler flags
 PLATFORM_FLAGS = -pipe -DNETBSD -DNetBSD
 PORT_FLAGS = -DHAVE_STRERROR
-OS_CFLAGS = $(DSO_CFLAGS) $(PLATFORM_FLAGS) $(PORT_FLAGS)
+OS_CFLAGS += $(DSO_CFLAGS) $(PLATFORM_FLAGS) $(PORT_FLAGS)
 
 PLATFORM_FLAGS +=
 PORT_FLAGS +=
 
+# Linker flags
+OS_DLLFLAGS +=
+
 GLIB_CONFIG = glib-config
 GTK_CONFIG = gtk-config
 GNOME_CONFIG = gnome-config
@@ -101,5 +109,12 @@
 
 ABI_NATIVE = unix
 ABI_FE = Unix
+
+##################################################################
+## ABIPKGDIR defines the directory containing the Makefile to use to
+## build a set of distribution archives (.deb, .rpm, .tgz, .exe, etc)
+## This is relative to $(ABI_ROOT)/src/pkg
+
+ABIPKGDIR = netbsd
 
 # End of NetBSD defs
--- src/config/require/unix/Makefile.orig Tue Feb 1 18:55:24 2000
+++ src/config/require/unix/Makefile Tue Feb 29 12:05:03 2000
@@ -74,7 +74,9 @@
 
 _ZLIB_:
         @if [ -r /usr/lib/libz.a \
+ -o -r ${LOCALBASE}/lib/libz.a \
               -o -r /usr/local/lib/libz.a \
+ -o -r ${X11BASE}/lib/libz.a \
               -o -r /usr/X11R6/lib/libz.a \
             ]; then \
                 echo Found zlib in system directories; \
@@ -90,7 +92,9 @@
 
 _LIBPNG_:
         @if [ -r /usr/lib/libpng.a \
+ -o -r ${LOCALBASE}/lib/libpng.a \
               -o -r /usr/local/lib/libpng.a \
+ -o -r ${X11BASE}/lib/libpng.a \
               -o -r /usr/X11R6/lib/libpng.a \
             ]; then \
                 echo Found libpng in system directories; \
--- src/hello/main/unix/Makefile.orig Mon Dec 13 16:10:25 1999
+++ src/hello/main/unix/Makefile Tue Feb 29 12:05:03 2000
@@ -24,7 +24,7 @@
 
 CPPSRCS= UnixMain.cpp
 
-INCLUDES= `gtk-config --cflags`
+INCLUDES= $(GTK_CFLAGS)
 
 PROGRAM= AbiHello
 
--- src/pkg/common/unix/scripts/install.sh.orig Wed Jun 2 16:19:32 1999
+++ src/pkg/common/unix/scripts/install.sh Tue Feb 29 12:17:41 2000
@@ -2,14 +2,14 @@
 #
 # This script is invoked by the Makefiles when the "install" target
 # is specified. It just puts things where most users will probably
-# be happy, in $TARGET, with symbolic links (in $BINDIR) to the binaries
-# in $TARGET/bin
+# be happy, in $TARGET, with the binaries in $LIBEXECDIR, with
+# symbolic links (in $BINDIR) to the binaries in $LIBEXECDIR.
 #
 # $SRCDIR should be the place where the compile process (the "canonical"
 # target especially) put all the stuff. $SCRIPTDIR should be set by the
 # caller so we can know where we are. $BINDIR is where the symbolic
-# links are eventually installed, to point to the "bin/*" files within
-# $TARGET/bin
+# links are eventually installed, to point to the executable files within
+# $LIBEXECDIR
 
 # if no target, bail
 if [ -z "$TARGET" ]
@@ -52,6 +52,21 @@
     exit 1
 fi
 
+# Make sure the libexec dir exists
+if [ -z "$LIBEXECDIR" ]
+then
+ LIBEXECDIR=${TARGET}/bin
+fi
+mkdir -p $LIBEXECDIR
+
+if [ ! -d $LIBEXECDIR ]
+then
+ echo ""
+ echo "Error creating directory [$LIBEXECDIR]."
+ echo ""
+ exit 1
+fi
+
 # start with breathing room
 echo ""
 
@@ -63,9 +78,9 @@
 # Copy the files from $SRCDIR to $TARGET
 (cd $SRCDIR/AbiSuite; tar cf - *) | (cd $TARGET; tar xf -)
 
-echo "Installing program binaries to [$TARGET/bin]..."
+echo "Installing program binaries to [$LIBEXECDIR]..."
 # Setup bins
-(cd $SRCDIR; tar cf - bin/Abi*) | (cd $TARGET; tar xf -)
+(cd $SRCDIR/bin; tar cf - Abi*) | (cd $LIBEXECDIR; tar xf -)
 
 ########################################################################
 # If we're on Solaris, run makepsres on the font path
@@ -91,10 +106,10 @@
 cd $SCRIPTDIR
 
 echo "Making wrapper script at [$TARGET/bin/AbiWord]..."
-./makewrapper.sh AbiWord $TARGET
+./makewrapper.sh AbiWord $TARGET $LIBEXECDIR
 # TODO : make use of these
-# ./makewrapper.sh AbiCalc $TARGET
-# ./makewrapper.sh AbiFile $TARGET
+# ./makewrapper.sh AbiCalc $TARGET $LIBEXECDIR
+# ./makewrapper.sh AbiFile $TARGET $LIBEXECDIR
 
 
 ########################################################################
@@ -107,12 +122,12 @@
 
 # NOTE : Solaris ln doesn't seem to honor the -f (force flag), so
 # NOTE : we have to remove them first.
-rm -f $BINDIR/AbiWord ; ln -s $TARGET/bin/AbiWord $BINDIR/AbiWord
-rm -f $BINDIR/abiword ; ln -s $TARGET/bin/AbiWord $BINDIR/abiword
+rm -f $BINDIR/AbiWord ; ln -s $LIBEXECDIR/AbiWord $BINDIR/AbiWord
+rm -f $BINDIR/abiword ; ln -s $LIBEXECDIR/AbiWord $BINDIR/abiword
 
 # TODO : make use of these, etc.
-# rm -f $BINDIR/AbiCalc ; ln -s $TARGET/bin/AbiCalc $LINK_DIR/AbiCalc
-# rm -f $BINDIR/abicalc ; ln -s $TARGET/bin/AbiCalc $LINK_DIR/abicalc
+# rm -f $BINDIR/AbiCalc ; ln -s $LIBEXECDIR/AbiCalc $LINK_DIR/AbiCalc
+# rm -f $BINDIR/abicalc ; ln -s $LIBEXECDIR/AbiCalc $LINK_DIR/abicalc
 
 ########################################################################
 # Done
--- src/pkg/common/unix/scripts/makewrapper.sh.orig Thu Jun 24 16:54:37 1999
+++ src/pkg/common/unix/scripts/makewrapper.sh Tue Feb 29 12:19:00 2000
@@ -3,15 +3,16 @@
 # This script is invoked to create wrapper scripts for AbiSuite
 # binaries. One should pass it the _base_ name of the program
 # to wrap (one would pass "AbiWord" to wrap "AbiWord_s" and
-# "AbiWord_d"), and the install base of the tree, to which "bin"
-# will be appended for binary and script locations.
+# "AbiWord_d"), the install base of the tree and, optionally, the location
+# of the machine-dependent binaries and scripts.
 
 # Examples:
-# makewrapper.sh AbiWord /usr/local/AbiSuite
-# makewrapper.sh AbiCalc /usr/local/AbiSuite
+# makewrapper.sh AbiWord /usr/local/AbiSuite /usr/local/libexec/AbiSuite
+# makewrapper.sh AbiCalc /usr/local/AbiSuite /usr/local/libexec/AbiSuite
 
 PROGRAM_NAME=$1
 INSTALL_BASE=$2
+LIBEXECDIR=$3
 
 # Did they supply any arguments?
 if [ -z "$PROGRAM_NAME" ]
@@ -28,11 +29,15 @@
     echo ""
     exit 1
 fi
+if [ -z "$LIBEXECDIR" ]
+then
+ LIBEXECDIR=${INSTALL_BASE}/bin
+fi
 
 # Make directory path up to program we're creating
-mkdir -p $INSTALL_BASE/bin
+mkdir -p $LIBEXECDIR
 
-cat >$INSTALL_BASE/bin/$PROGRAM_NAME<<EOF
+cat >$LIBEXECDIR/$PROGRAM_NAME<<EOF
 #!/bin/sh
 #
 # AbiSuite program wrapper script, dynamically generated
@@ -42,6 +47,9 @@
 ABISUITE_HOME=$INSTALL_BASE
 export ABISUITE_HOME
 
+# Change this if you move the AbiSuite binaries.
+ABISUITE_LIBEXEC=$LIBEXECDIR
+
 # Change this if you move your fonts.
 ABISUITE_FONT_HOME=\$ABISUITE_HOME/fonts
 
@@ -52,18 +60,18 @@
 fi
 
 # Figure out which binary to run
-if [ -f \$ABISUITE_HOME/bin/${PROGRAM_NAME}_d ]
+if [ -f \$ABISUITE_LIBEXEC/${PROGRAM_NAME}_d ]
 then
- \$ABISUITE_HOME/bin/${PROGRAM_NAME}_d "\$@"
-elif [ -f \$ABISUITE_HOME/bin/${PROGRAM_NAME}_s ]
+ \$ABISUITE_LIBEXEC/${PROGRAM_NAME}_d "\$@"
+elif [ -f \$ABISUITE_LIBEXEC/${PROGRAM_NAME}_s ]
 then
- \$ABISUITE_HOME/bin/${PROGRAM_NAME}_s "\$@"
+ \$ABISUITE_LIBEXEC/${PROGRAM_NAME}_s "\$@"
 else
     echo ""
     echo "Error: can't find ${PROGRAM_NAME} executables:"
- echo " \$ABISUITE_HOME/bin/${PROGRAM_NAME}_d"
+ echo " \$ABISUITE_LIBEXEC/${PROGRAM_NAME}_d"
     echo " -or-"
- echo " \$ABISUITE_HOME/bin/${PROGRAM_NAME}_s"
+ echo " \$ABISUITE_LIBEXEC/${PROGRAM_NAME}_s"
     echo ""
     exit
 fi
@@ -75,6 +83,6 @@
 fi
 EOF
 
-chmod 755 ${INSTALL_BASE}/bin/$PROGRAM_NAME
+chmod 755 ${LIBEXECDIR}/$PROGRAM_NAME
 
 
--- src/wp/main/unix/Makefile.orig Mon Dec 13 16:10:26 1999
+++ src/wp/main/unix/Makefile Tue Feb 29 12:05:03 2000
@@ -24,7 +24,7 @@
 
 CPPSRCS= UnixMain.cpp
 
-INCLUDES= `$(GTK_CONFIG) --cflags`
+INCLUDES= $(GTK_CFLAGS)
 
 PROGRAM= $(BINDIR)/AbiWord_d
 PROGRAM_S= $(BINDIR)/AbiWord_s
--- src/wp/main/unix/gnome/Makefile.orig Mon Dec 13 16:10:26 1999
+++ src/wp/main/unix/gnome/Makefile Tue Feb 29 12:05:03 2000
@@ -24,7 +24,7 @@
 
 CPPSRCS= UnixGnomeMain.cpp
 
-INCLUDES= `$(GNOME_CONFIG) gnomeui --cflags`
+INCLUDES= $(GNOME_CFLAGS)
 
 PROGRAM= $(BINDIR)/AbiWord_d
 PROGRAM_S= $(BINDIR)/AbiWord_s
--- /dev/null Tue Feb 29 11:59:52 2000
+++ src/pkg/netbsd/Makefile Tue Feb 29 12:35:49 2000
@@ -0,0 +1,9 @@
+ABI_ROOT:=$(shell pwd)/../../..
+include $(ABI_ROOT)/src/config/abi_defs_wp.mk
+include $(ABI_ROOT)/src/config/abi_rules.mk
+
+# The plain "install" common to all Unix targets
+install:
+ @TARGET=$(prefix)/AbiSuite BINDIR=$(prefix)/bin SRCDIR=$(OUTDIR) \
+ SCRIPTDIR=$(ABI_ROOT)/src/pkg/common/unix/scripts \
+ $(ABI_ROOT)/src/pkg/common/unix/scripts/install.sh



This archive was generated by hypermail 2b25 : Tue Feb 29 2000 - 11:38:42 CST