[irrtoolset]Porting RAToolSet 4.7.1 to the NetBSD package system

Havard Eidnes he at uninett.no
Tue Jan 20 21:32:53 CET 2004


Hi,

I'm in the process of making a package in the NetBSD package
system for RAToolSet, version 4.7.1.  In the process I've
uncovered a few issues which I think merit fixing cross-platform:

 o As far as I know, it is quite non-portable to link C++ programs
   using $(LD) directly.  The reason is that you then have to know
   or detect what system-, architecture-, and compiler-dependent
   libraries need to be supplied.  It is much easier to just rely on
   the C++ compiler dealing with those issues, so in the individual
   Makefile.in's I'm using $(CXX) instead of $(LD).  (My ld doesn't
   much care for -O2 or -I options...)

 o Your bison invocations all use the '-p' option to specify a
   different file prefix than 'y.'.  However, the subsequent
   renames do not take into account that the output files are no
   longer named y.tab.c and y.tab.h.

 o Some of the Makefile.in's in the tree suppress compiler
   invocation with @ and instead emit "Compiling ...".  This is IMHO
   unnecessary obfuscation making it more difficult to debug build
   problems, so I've obliterated a few of them.

 o src/roe/RadixSet.hh and src/Core/util/List.hh needed to have a
   few instances of NULL replaced with 0.  The complaint from gcc
   2.95.3 (which is newer than the documented minimum version)
   was:

    c++ -c -I/usr/pkg/include -I/usr/X11R6/include -O2 -I/usr/pkg/include -I/usr/X11R6/include -DHAVE_CONFIG_H -I. -I. -I../../src -I.. -I../../src/Core -I../../src/rpsl  -I/usr/X11R6/include object.cc
    In file included from route-list.hh:42,
		     from object.cc:40:
    RadixSet.hh:63: `NULL' was not declared in this scope
    RadixSet.hh:63: confused by earlier errors, bailing out
    gmake[2]: *** [object.o] Error 1
    gmake[2]: Leaving directory `/usr/pkgsrc/net/RAToolSet/work/RAToolSet-4.7.1/src/roe'

   I suspect the template implementation has not fully settled to
   tackle this.  Using the 0 literal in a pointer context should, if
   I recall correctly, not cause any portability problems, but I am
   no C++ language expert...

 o I needed some system-dependent changes to get proper run-path set
   in the executables on NetBSD.  NetBSD requires explicit
   -Wl,-R<libdir> specification, and does not derive that
   information from passed -L<libdir> options.  I've omitted most of
   these changes (I'm a little doubtful of their portability),
   except I've left in the change in which src/roe gets $(LDFLAGS)
   passed to the compiler's link step.

The patches to the individual files I touched can be found in the
shar archive attached below.

Regards,

- Håvard
-------------- next part --------------
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	patch-aa
#	patch-ab
#	patch-ac
#	patch-ad
#	patch-ae
#	patch-af
#	patch-ag
#	patch-ah
#	patch-ai
#	patch-aj
#	patch-ak
#	patch-al
#	patch-am
#	patch-an
#
echo x - patch-aa
sed 's/^X//' >patch-aa << 'END-of-patch-aa'
X$NetBSD$
X
X--- src/rpsl/rpsl/Makefile.in.orig	Thu Oct 28 20:43:33 1999
X+++ src/rpsl/rpsl/Makefile.in
X@@ -60,8 +60,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c `basename $<`.cc
X-	mv y.tab.h `basename $<`.hh
X+	mv `basename $< .y`.tab.c `basename $<`.cc
X+	mv `basename $< .y`.tab.h `basename $<`.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
END-of-patch-aa
echo x - patch-ab
sed 's/^X//' >patch-ab << 'END-of-patch-ab'
X$NetBSD$
X
X--- src/Core/gnu/Makefile.in.orig	Thu Jan  6 00:23:23 2000
X+++ src/Core/gnu/Makefile.in
X@@ -60,12 +60,10 @@ default: all
X .y.o:
X 
X .c.o:
X-	@echo Compiling: `basename $<`
X-	@$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .cc.o:
X-	@echo Compiling: `basename $<`
X-	@$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .SUFFIXES: .cc
X 
END-of-patch-ab
echo x - patch-ac
sed 's/^X//' >patch-ac << 'END-of-patch-ac'
X$NetBSD$
X
X--- src/Core/sched/Makefile.in.orig	Tue Jun 15 17:39:18 1999
X+++ src/Core/sched/Makefile.in
X@@ -45,12 +45,10 @@ default: all
X .y.o:
X 
X .c.o:
X-	@echo Compiling: `basename $<`
X-	@$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .cc.o:
X-	@echo Compiling: `basename $<`
X-	@$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .SUFFIXES: .cc
X 
END-of-patch-ac
echo x - patch-ad
sed 's/^X//' >patch-ad << 'END-of-patch-ad'
X$NetBSD$
X
X--- src/Core/sys/Makefile.in.orig	Tue Jun 15 17:39:18 1999
X+++ src/Core/sys/Makefile.in
X@@ -65,12 +65,10 @@ default: all
X .y.o:
X 
X .c.o:
X-	@echo Compiling: `basename $<`
X-	@$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .cc.o:
X-	@echo Compiling: `basename $<`
X-	@$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .SUFFIXES: .cc
X 
END-of-patch-ad
echo x - patch-ae
sed 's/^X//' >patch-ae << 'END-of-patch-ae'
X$NetBSD$
X
X--- src/Core/util/Makefile.in.orig	Tue Jul 20 20:48:49 1999
X+++ src/Core/util/Makefile.in
X@@ -49,12 +49,10 @@ default: all
X .y.o:
X 
X .c.o:
X-	@echo Compiling: `basename $<`
X-	@$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .cc.o:
X-	@echo Compiling: `basename $<`
X-	@$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .SUFFIXES: .cc
X 
END-of-patch-ae
echo x - patch-af
sed 's/^X//' >patch-af << 'END-of-patch-af'
X$NetBSD$
X
X--- src/rpslcheck/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/rpslcheck/Makefile.in
X@@ -74,7 +74,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X 
X dolibs:
X 	@ for f in $(REQUIRES); do cd ../$$f; $(MAKE) $(MFLAGS); done
END-of-patch-af
echo x - patch-ag
sed 's/^X//' >patch-ag << 'END-of-patch-ag'
X$NetBSD$
X
X--- src/peval/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/peval/Makefile.in
X@@ -52,8 +52,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c $<.cc
X-	mv y.tab.h $<.hh
X+	mv `basename $< .y`.tab.c $<.cc
X+	mv `basename $< .y`.tab.h $<.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
X@@ -74,7 +74,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X 
X dolibs:
X 	@ for f in $(REQUIRES); do cd ../$$f; $(MAKE) $(MFLAGS); done
END-of-patch-ag
echo x - patch-ah
sed 's/^X//' >patch-ah << 'END-of-patch-ah'
X$NetBSD$
X
X--- src/RtConfig/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/RtConfig/Makefile.in
X@@ -52,8 +52,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c `basename $<`.cc
X-	mv y.tab.h `basename $<`.hh
X+	mv `basename $< .y`.tab.c `basename $<`.cc
X+	mv `basename $< .y`.tab.h `basename $<`.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
X@@ -74,7 +74,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X 
X dolibs:
X 	@ for f in $(REQUIRES); do cd ../$$f; $(MAKE) $(MFLAGS); done
END-of-patch-ah
echo x - patch-ai
sed 's/^X//' >patch-ai << 'END-of-patch-ai'
X$NetBSD$
X
X--- src/prtraceroute/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/prtraceroute/Makefile.in
X@@ -53,8 +53,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c `basename $<`.cc
X-	mv y.tab.h `basename $<`.hh
X+	mv `basename $< .y`.tab.c `basename $<`.cc
X+	mv `basename $< .y`.tab.h `basename $<`.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
X@@ -75,7 +75,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X 
X dolibs:
X 	@ for f in $(REQUIRES); do cd ../$$f; $(MAKE) $(MFLAGS); done
END-of-patch-ai
echo x - patch-aj
sed 's/^X//' >patch-aj << 'END-of-patch-aj'
X$NetBSD$
X
X--- src/CIDRAdvisor/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/CIDRAdvisor/Makefile.in
X@@ -50,8 +50,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c `basename $<`.cc
X-	mv y.tab.h `basename $<`.hh
X+	mv `basename $< .y`.tab.c `basename $<`.cc
X+	mv `basename $< .y`.tab.h `basename $<`.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
X@@ -72,7 +72,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X 
X dolibs:
X 	@ for f in $(REQUIRES); do cd ../$$f; $(MAKE) $(MFLAGS); done
END-of-patch-aj
echo x - patch-ak
sed 's/^X//' >patch-ak << 'END-of-patch-ak'
X$NetBSD$
X
X--- src/roe/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/roe/Makefile.in
X@@ -63,8 +63,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c $<.cc
X-	mv y.tab.h $<.hh
X+	mv `basename $< .y`.tab.c $<.cc
X+	mv `basename $< .y`.tab.h $<.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
X@@ -72,12 +72,10 @@ default: all
X 	mv lex.`basename $< .l`.c $<.cc
X 
X .c.o:
X-	@echo Compiling: `basename $<`
X-	@$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CC)  -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X .cc.o:
X-	@echo Compiling: `basename $<`
X-	@$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) $(INCDIRS) $<
X 
X # Transformations applied to each line of the file:
X #       eliminate blank lines
X@@ -117,7 +115,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LDFLAGS) $(LIBS)
X 
X dolibs:
X 	@ cd ..; $(MAKE) $(MFLAGS) dolibs
END-of-patch-ak
echo x - patch-al
sed 's/^X//' >patch-al << 'END-of-patch-al'
X$NetBSD$
X
X--- src/roe/RadixSet.hh.orig	Tue Feb 20 17:11:55 2001
X+++ src/roe/RadixSet.hh
X@@ -46,10 +46,10 @@
X 
X class RadixNode {
X public:
X-   RadixNode() : left(NULL), rght(NULL), prnt(NULL),
X-      state(RADIX_EMPTY), data(NULL) {}
X-   RadixNode(RadixNode *p) : left(NULL), rght(NULL), prnt(p),
X-      state(RADIX_EMPTY), data(NULL){}
X+   RadixNode() : left(0), rght(0), prnt(0),
X+      state(RADIX_EMPTY), data(0) {}
X+   RadixNode(RadixNode *p) : left(0), rght(0), prnt(p),
X+      state(RADIX_EMPTY), data(0){}
X 
X    RadixNode *left; // left child
X    RadixNode *rght; // right child
X@@ -58,7 +58,7 @@ public:
X    int state;   // state == empty is an intermediate node which is not in tree
X    void *data;  // 
X 
X-   RadixNode *insert(void *dt = NULL);
X+   RadixNode *insert(void *dt = 0);
X    RadixNode *find(PrefixRange *dt);
X    RadixNode *next(); // returns the next rt in radix order
X 
X@@ -69,7 +69,7 @@ private:
X template <class T>
X class Radix : public RadixNode {
X public:
X-   RadixNode *insert(T *dt = NULL) {
X+   RadixNode *insert(T *dt = 0) {
X       return RadixNode::insert(dt);
X    }
X 
X@@ -79,9 +79,9 @@ public:
X 
X   void clear(void) { 
X     clear(this); 
X-    left = rght = prnt =  NULL;
X+    left = rght = prnt =  0;
X     state = RADIX_EMPTY;
X-    data = NULL;
X+    data = 0;
X   }
X   void clear(RadixNode *r) {
X     if (!r) return;
END-of-patch-al
echo x - patch-am
sed 's/^X//' >patch-am << 'END-of-patch-am'
X$NetBSD$
X
X--- src/prpath/Makefile.in.orig	Thu Jun 15 20:51:23 2000
X+++ src/prpath/Makefile.in
X@@ -50,8 +50,8 @@ default: all
X %.y.cc %.y.hh: %.y
X 	@echo Compiling: `basename $<`
X 	$(BISON) -d -p `basename $< .y` $<
X-	mv y.tab.c `basename $<`.cc
X-	mv y.tab.h `basename $<`.hh
X+	mv `basename $< .y`.tab.c `basename $<`.cc
X+	mv `basename $< .y`.tab.h `basename $<`.hh
X 
X %.l.cc: %.l
X 	@echo Compiling: `basename $<`
X@@ -72,7 +72,7 @@ default: all
X all: $(GOAL)
X 
X $(GOAL): $(OBJS) dolibs
X-	$(LD) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X+	$(CXX) $(CFLAGS) -o $(GOAL) $(OBJS) $(LIBS)
X 
X dolibs:
X 	@ for f in $(REQUIRES); do cd ../$$f; $(MAKE) $(MFLAGS); done
END-of-patch-am
echo x - patch-an
sed 's/^X//' >patch-an << 'END-of-patch-an'
X$NetBSD$
X
X--- src/Core/util/List.hh.orig	Fri Nov 10 00:50:57 2000
X+++ src/Core/util/List.hh
X@@ -352,19 +352,19 @@ public:
X 
X    // traversal routines
X    T *head() const {
X-      return (forw == (const ListNode *) this) ? (T *) NULL : (T *) forw;
X+      return (forw == (const ListNode *) this) ? (T *) 0 : (T *) forw;
X    }
X 
X    T *tail() const {
X-      return (back == (const ListNode *) this) ? (T *) NULL : (T *) back;
X+      return (back == (const ListNode *) this) ? (T *) 0 : (T *) back;
X    }
X 
X    T *next(const T *n) const {
X-      return (n->forw == (const ListNode *) this) ? (T *) NULL : (T *) n->forw;
X+      return (n->forw == (const ListNode *) this) ? (T *) 0 : (T *) n->forw;
X    }
X 
X    T *prev(const T *n) const {
X-      return (n->back == (const ListNode *) this) ? (T *) NULL : (T *) n->back;
X+      return (n->back == (const ListNode *) this) ? (T *) 0 : (T *) n->back;
X    }
X };
X 
END-of-patch-an
exit



More information about the irrtoolset mailing list