[leaf-commits] src/bering-uclibc4/source/aiccu 100-cross_compile.patch, NONE, 1.1 200-add_dn_skipname.patch, NONE, 1.1 aiccu-makefile.patch, NONE, 1.1 aiccu-uclibc-resolver.patch, NONE, 1.1 aiccu.init, NONE, 1.1 aiccu_20070115.tar.gz, NONE, 1.1 buildtool.cfg, NONE, 1.1 buildtool.mk, NONE, 1.1

Andrew <[email protected]>
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/source/aiccu
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30343

Added Files:
	100-cross_compile.patch 200-add_dn_skipname.patch 
	aiccu-makefile.patch aiccu-uclibc-resolver.patch aiccu.init 
	aiccu_20070115.tar.gz buildtool.cfg buildtool.mk 
Log Message:
Fixed makefile


--- NEW FILE: 100-cross_compile.patch ---
diff -urN aiccu/unix-console/Makefile aiccu.new/unix-console/Makefile
--- aiccu/unix-console/Makefile	2007-01-15 12:04:27.000000000 +0100
+++ aiccu.new/unix-console/Makefile	2007-01-18 15:08:28.000000000 +0100
@@ -10,6 +10,9 @@
 #  $Date: 2010/07/06 23:17:57 $
 # **********************************************************/
 
+OS_NAME=$(shell uname)
+OS_VERSION=$(shell uname -r)
+
 SRCS	= main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c
 INCS	= ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h
 OBJS	= main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o
@@ -40,13 +43,13 @@
 # GnuTLS Support ?
 # Used by TIC to secure that communication
 # Currently defaultly builds only on Linux, but other platforms might easily also support it
-ifeq ($(shell uname | grep -c "Linux"),1)
+ifneq ($(HAVE_GNUTLS),)
 CFLAGS	+= -D AICCU_GNUTLS
 LDFLAGS += -lgnutls
 endif
 
 # Linux
-ifeq ($(shell uname | grep -c "Linux"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "Linux"),1)
 CFLAGS  += -D_LINUX -D HAS_IFHEAD -D AICCU_TYPE="\"linux\""
 SRCS	+= ../common/aiccu_linux.c
 OBJS	+= ../common/aiccu_linux.o
@@ -54,11 +57,11 @@
 endif
 
 # FreeBSD
-ifeq ($(shell uname | grep -c "FreeBSD"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "FreeBSD"),1)
 CFLAGS	+= -D_FREEBSD
 
 # FreeBSD 4.x
-ifeq ($(shell uname -r | cut -c 1),4)
+ifeq ($(shell echo $(OS_VERSION) | cut -c 1),4)
 CFLAGS	+= -D AICCU_TYPE="\"freebsd4\""
 SRCS	+= ../common/aiccu_freebsd4.c
 OBJS	+= ../common/aiccu_freebsd4.o
@@ -71,7 +74,7 @@
 endif
 
 # DragonFlyBSD
-ifeq ($(shell uname | grep -c "DragonFly"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "DragonFly"),1)
 CFLAGS	+= -D_DFBSD -D NEED_IFHEAD -D AICCU_TYPE="\"dragonfly\""
 SRCS	+= ../common/aiccu_freebsd4.c
 OBJS	+= ../common/aiccu_freebsd4.o
@@ -79,7 +82,7 @@
 endif
 
 # NetBSD
-ifeq ($(shell uname | grep -c "NetBSD"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "NetBSD"),1)
 CFLAGS	+= -D_NETBSD -D AICCU_TYPE="\"kame\""
 
 # Check if net/if_tun.h has TUNSIFHEAD and enable support for it
@@ -97,10 +100,10 @@
 endif
 
 # OpenBSD
-ifeq ($(shell uname | grep -c "OpenBSD"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "OpenBSD"),1)
 CFLAGS	+= -D_OPENBSD -D HAS_IFHEAD
 # 2.7-2.9
-ifeq ($(shell uname -r | cut -c 1),2)
+ifeq ($(shell echo $(OS_VERSION) | cut -c 1),2)
 CFLAGS	+= -D AICCU_TYPE="\"openbsd2\""
 SRCS	+= ../common/aiccu_openbsd2.c
 OBJS	+= ../common/aiccu_openbsd2.o
@@ -114,7 +117,7 @@
 endif
 
 # Darwin
-ifeq ($(shell uname | grep -c "Darwin"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "Darwin"),1)
 CFLAGS	+= -D_DARWIN -D NEED_IFHEAD -D AICCU_TYPE="\"darwin\""
 SRCS	+= ../common/aiccu_darwin.c
 OBJS	+= ../common/aiccu_darwin.o
@@ -122,7 +125,7 @@
 endif
 
 # SunOS / Solaris
-ifeq ($(shell uname | grep -c "SunOS"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "SunOS"),1)
 CFLAGS	+= -D_SUNOS -D AICCU_TYPE="\"sunos\""
 SRCS	+= ../common/aiccu_sunos.c
 OBJS	+= ../common/aiccu_sunos.o
@@ -130,7 +133,7 @@
 endif
 
 # AIX
-ifeq ($(shell uname | grep -c "AIX"),1)
+ifeq ($(shell echo $(OS_NAME) | grep -c "AIX"),1)
 CC	= @/usr/vac/bin/xlc_r
 CFLAGS	= -qthreaded -q64 -qlanglvl=stdc99 -bmaxdata:0xD0000000 -D_64BIT -g -qdbxextra -qfullpath -qheapdebug -qformat=all -qcheck=all
 CFLAGS	+= -D AICCU_CONSOLE

--- NEW FILE: aiccu_20070115.tar.gz ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: buildtool.mk ---
# makefile for aiccu, adapted from bash
include $(MASTERMAKEFILE)

AICCU_DIR:=aiccu
AICCU_TARGET_DIR:=$(BT_BUILD_DIR)/aiccu

$(AICCU_DIR)/.source:
	zcat $(SRC_TARBALL) | tar -xvf -
	(cd $(AICCU_DIR) && patch -p1) < $(PATCH_UCLIBC_RESOLVER)
	(cd $(AICCU_DIR) && patch -p1) < $(PATCH_OPENWRT_100)
	(cd $(AICCU_DIR) && patch -p1) < $(PATCH_OPENWRT_200)
	(cd $(AICCU_DIR) && patch -p1) < $(PATCH_MAKEFILE)
	touch $(AICCU_DIR)/.source

source: $(AICCU_DIR)/.source

$(AICCU_DIR)/.configured: $(AICCU_DIR)/.source
	touch $(AICCU_DIR)/.configured

$(AICCU_DIR)/.build: $(AICCU_DIR)/.configured
	CC=$(TARGET_CC) CFLAGS="$(BT_COPT_FLAGS)" make -C $(AICCU_DIR) all
	mkdir -p "$(AICCU_TARGET_DIR)"
	cd "$(AICCU_TARGET_DIR)" && mkdir -p usr/sbin etc etc/init.d
	-$(BT_STRIP) $(BT_STRIP_BINOPTS) $(AICCU_DIR)/unix-console/aiccu
	cp -a $(AICCU_DIR)/unix-console/aiccu $(AICCU_TARGET_DIR)/usr/sbin
	cp -a $(AICCU_DIR)/doc/aiccu.conf     $(AICCU_TARGET_DIR)/etc
	cp -a aiccu.init $(AICCU_TARGET_DIR)/etc/init.d/aiccu
	cp -a $(AICCU_TARGET_DIR)/* $(BT_STAGING_DIR)
	touch $@

build: $(AICCU_DIR)/.build

clean:
	make -C $(AICCU_DIR) clean
	rm -rf $(AICCU_TARGET_DIR)
	rm -f $(AICCU_DIR)/.build
	rm -f $(AICCU_DIR)/.configured

srcclean: clean
	rm -rf $(AICCU_DIR) 
	rm -f $(AICCU_DIR)/.source

--- NEW FILE: aiccu-uclibc-resolver.patch ---
diff -ru aiccu.orig/common/resolver.c aiccu/common/resolver.c
--- aiccu.orig/common/resolver.c	2006-07-23 16:55:14.000000000 +0200
+++ aiccu/common/resolver.c	2007-11-16 06:14:56.000000000 +0100
@@ -26,9 +26,6 @@
 
 int getrrs(const char *label, int rrtype, void gotrec(unsigned int num, int type, const char *record))
 {
-#ifdef _LINUX
-	struct __res_state	res;
-#endif
 	unsigned char		answer[8192];
 	HEADER			*header = (HEADER *)answer;
 	char			buf[2048];
@@ -38,20 +35,10 @@
 	uint16_t		type = 0, class = 0;
 	uint32_t		ttl = 0;
 
-#ifdef _LINUX
-	memset(&res, 0, sizeof(res));
-	res.options = RES_DEBUG;
-	res_ninit(&res);
-#else
 	res_init();
-#endif
 
 	memset(answer, 0, sizeof(answer));
-#ifdef _LINUX
-	ret = res_nquery(&res, label, C_IN, rrtype, answer, sizeof(answer));
-#else
 	ret = res_query(label, C_IN, rrtype, answer, sizeof(answer));
-#endif
 	if (ret < 0) return -1;
 
 	/* Our start and end */

--- NEW FILE: aiccu.init ---
#! /bin/sh
#
# /etc/init.d/aiccu: start / stop AICCU
#
# Jeroen Massar <[email protected]>
RCDLINKS="0,K50 1,K50 2,S75 3,S75 4,S75 5,S75 6,K50"

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=aiccu
DAEMON=/usr/sbin/${NAME}
DESC="SixXS Automatic IPv6 Connectivity Client Utility (${NAME})"
BACKGROUND=true

# Options
OPTIONS=""

test -x $DAEMON || exit 0

# Verify that the configuration file exists
if [ ! -f /etc/aiccu.conf ]; then
	echo "AICCU Configuration file /etc/aiccu.conf doesn't exist"
	exit 0;
fi

# Verify that the configuration is correct
if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
	echo "AICCU is not configured, edit /etc/aiccu.conf first"
	exit 0;
fi

if [ -f /etc/default/${NAME} ]; then
	. /etc/default/${NAME}
fi

if [ "$BACKGROUND" = "false" ]; then
	exit 0;
fi

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --oknodo --quiet --exec $DAEMON -- start $OPTIONS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON -- stop
	echo "$NAME."
	;;
  restart|reload|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON -- stop
	sleep 2
	start-stop-daemon --start --oknodo --quiet --exec $DAEMON -- start $OPTIONS
	echo "$NAME."
	;;
  *)
	echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}" >&2
	exit 1
esac

exit 0


--- NEW FILE: buildtool.cfg ---
<File buildtool.mk>
	Server = cvs4-sourceforge
	Revision = HEAD
	Directory = aiccu
</File>

<File aiccu_20070115.tar.gz>
	Server = cvs4-sourceforge
	Revision = HEAD
	envname = SRC_TARBALL
	Directory = aiccu
</File>

<File aiccu.init>
	Server = cvs4-sourceforge
	Revision = HEAD
	Directory = aiccu
</File>

# Remove resolver parts not in uclibc
<File aiccu-uclibc-resolver.patch>
	Server = cvs4-sourceforge
	Revision = HEAD
	Directory = aiccu
	envname = PATCH_UCLIBC_RESOLVER
</File>

# https://svn.openwrt.org/openwrt/packages/ipv6/aiccu/patches/100-cross_compile.patch
<File 100-cross_compile.patch>
	Server = cvs4-sourceforge
	Revision = HEAD
	Directory = aiccu
	envname = PATCH_OPENWRT_100
</File>

# https://svn.openwrt.org/openwrt/packages/ipv6/aiccu/patches/200-add_dn_skipname.patch
<File 200-add_dn_skipname.patch>
	Server = cvs4-sourceforge
	Revision = HEAD
	Directory = aiccu
	envname = PATCH_OPENWRT_200
</File>

#fix makefile CC hard assignment
<File aiccu-makefile.patch>
	Server = cvs4-sourceforge
	Revision = HEAD
	Directory = aiccu
	envname = PATCH_MAKEFILE
</File>

# FIXME:
# - write aiccu.txt  (cf. bin/packages/uclibc-0.9/20/contrib/README)
# - write aiccu.help (cf. bin/packages/uclibc-0.9/20/contrib/README)
# - No TLS support. That would require packaging
#   - gnutls which requires
#   - libgcrypt which requires
#   - libgpg-error which requires
#   - gawk
#   Yeah, that's it.

<Package>
	<aiccu>
		Version = 20070115
		Revision = 2

		Help <<EOF
		AICCU - SixXS Automatic IPv6 Connectivity Client Utility
		Homepage: http://www.sixxs.net/tools/aiccu/
		Requires: lpthread.lrp
		LEAF package by __PACKAGER__, __BUILDDATE__

		AICCU is the automatic IPv6 heartbeat and tunnel setup client
		used by the IPv6 tunnel broker SixXS.

		This package is compiled without TLS support.
		EOF

		<Permissions>
			Files = 644
			Directories = 755
		</Permissions>

		<Owner>
			Files = root:root
			Directories = root:root
		</Owner>
		<Contents>
			<File>
				Source		= etc/aiccu.conf
				Filename	= etc/aiccu.conf
				Type		= binary
				Type		= local
				Type		= conf
				Description     = aiccu configuration
			</File>
			<File>
				Source		= etc/init.d/aiccu
				Filename	= etc/init.d/aiccu
				Type		= binary
				Permissions	= 755
			</File>
			<File>
				Source		= usr/sbin/aiccu
				Filename	= usr/sbin/aiccu
				Type		= binary
				Permissions	= 755
			</File>
		</Contents>
	</aiccu>
</Package>

--- NEW FILE: 200-add_dn_skipname.patch ---
diff -Nru aiccu.old/common/dn_skipname.c aiccu/common/dn_skipname.c
--- aiccu.old/common/dn_skipname.c	1970-01-01 02:00:00.000000000 +0200
+++ aiccu/common/dn_skipname.c	2006-11-04 00:50:23.000000000 +0200
@@ -0,0 +1,51 @@
+#include <errno.h>
+#include <resolv.h>
+
+/* Ripped from glibc 2.4 sources. */
+
+/*
+ * ns_name_skip(ptrptr, eom)
+ *      Advance *ptrptr to skip over the compressed name it points at.
+ * return:
+ *      0 on success, -1 (with errno set) on failure.
+ */
+int ns_name_skip(const u_char **ptrptr, const u_char *eom)
+{
+	const u_char *cp;
+	u_int n;
+
+	cp = *ptrptr;
+	while (cp < eom && (n = *cp++) != 0)
+	{
+		/* Check for indirection. */
+		switch (n & NS_CMPRSFLGS) {
+		case 0:                 /* normal case, n == len */
+			cp += n;
+			continue;
+		case NS_CMPRSFLGS:      /* indirection */
+			cp++;
+			break;
+		default:                /* illegal type */
+			errno = EMSGSIZE;
+			return (-1);
+		}
+		break;
+	}
+	if (cp > eom)
+	{
+		errno = EMSGSIZE;
+		return (-1);
+	}
+	*ptrptr = cp;
+	return (0);
+}
+
+int dn_skipname(const u_char *ptr, const u_char *eom)
+{
+	const u_char *saveptr = ptr;
+
+	if(ns_name_skip(&ptr, eom) == -1)
+		return (-1);
+	return (ptr - saveptr);
+}
+
diff -Nru aiccu.old/unix-console/Makefile aiccu/unix-console/Makefile
--- aiccu.old/unix-console/Makefile	2006-11-04 00:51:20.000000000 +0200
+++ aiccu/unix-console/Makefile	2006-11-04 00:48:51.000000000 +0200
@@ -10,9 +10,9 @@
 #  $Date: 2010/07/06 23:17:57 $
 # **********************************************************/
 
-SRCS	= main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c
+SRCS	= main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ../common/dn_skipname.c
 INCS	= ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h
-OBJS	= main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o
+OBJS	= main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ../common/dn_skipname.o
 
 # New features not fully implemented and thus disabled for now
 #CFLAGS	+= -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE

--- NEW FILE: aiccu-makefile.patch ---
diff -aur aiccu.orig/unix-console/Makefile aiccu/unix-console/Makefile
--- aiccu.orig/unix-console/Makefile	2010-07-07 02:06:04.000000000 +0300
+++ aiccu/unix-console/Makefile	2010-07-07 02:06:45.963457362 +0300
@@ -29,7 +29,7 @@
 
 #CFLAGS	+= $(CWARNS) -D_GNU_SOURCE -D_DEBUG -g3 -O0
 CFLAGS	+= $(CWARNS) -D_GNU_SOURCE
-CC      = @gcc
+CC      ?= @gcc
 RM      = rm
 
 # Add -O3 when nothing is specified yet


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.