Bug 195424 - [Update] net/hanstunnel fix build with GCC
Summary: [Update] net/hanstunnel fix build with GCC
Status: Closed DUPLICATE of bug 195313
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Shaun Amott
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-26 19:31 UTC by vsityz
Modified: 2015-04-23 13:51 UTC (History)
2 users (show)

See Also:


Attachments
hanstunnel port (8.20 KB, text/plain)
2015-01-05 11:05 UTC, vsityz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description vsityz 2014-11-26 19:31:46 UTC
# 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:
#
#	hanstunnel
#	hanstunnel/distinfo
#	hanstunnel/Makefile
#	hanstunnel/files
#	hanstunnel/files/patch-Makefile
#	hanstunnel/files/patch-tun.cpp
#	hanstunnel/files/patch-echo.cpp
#	hanstunnel/pkg-message
#	hanstunnel/pkg-descr
#
echo c - hanstunnel
mkdir -p hanstunnel > /dev/null 2>&1
echo x - hanstunnel/distinfo
sed 's/^X//' >hanstunnel/distinfo << '65400445990c1970b9f5ad17ab147fd4'
XSHA256 (hans-0.4.4.tar.gz) = 81378258b8c9510ac01ad4d69f191e2927b9304daae033ee097f6ba4d39f6bb3
XSIZE (hans-0.4.4.tar.gz) = 33992
65400445990c1970b9f5ad17ab147fd4
echo x - hanstunnel/Makefile
sed 's/^X//' >hanstunnel/Makefile << '87523a3042cf8f2ebc7a9370982f09ef'
X# Created by: Alexander Panyushkin <vsityz@gmail.com>
X# $FreeBSD$
X
XPORTNAME=	hans
XPORTVERSION=	0.4.4
XPORTREVISION?=  1
XCATEGORIES=	net security
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	/hanstunnel/source/
X
XMAINTAINER=	vsityz@gmail.com
XCOMMENT=	Hans makes it possible to tunnel IPv4 through ICMP
X
XLICENSE=	GPLv3
X
XOPTIONS_DEFINE=		CLANG
XCLANG_DESC=		Build with Clang instead of GCC
XOPTIONS_DEFAULT=	CLANG
XPLIST_FILES=		${LOCALBASE}/bin/hans
X
X.include <bsd.port.options.mk>
X
X.if ${PORT_OPTIONS:MCLANG}
X.if ${OSVERSION} >=	900033 && exists(/usr/bin/clang)
XCC=			clang
XCXX=			clang++
X.else
XBUILD_DEPENDS+=		clang33:${PORTSDIR}/lang/clang33
XCC=			clang33
XCXX=			clang++33
X.endif
X.else
XCOMPILER_TYPE=		gcc
X.endif
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/hans ${STAGEDIR}${PREFIX}/bin/hans
X
Xpost-install:	.SILENT
X	${ECHO_MSG}
X	${CAT} ${PKGMESSAGE}
X	${ECHO_MSG}
X
X.include <bsd.port.mk>
87523a3042cf8f2ebc7a9370982f09ef
echo c - hanstunnel/files
mkdir -p hanstunnel/files > /dev/null 2>&1
echo x - hanstunnel/files/patch-Makefile
sed 's/^X//' >hanstunnel/files/patch-Makefile << '00f1877f7d4533cd6adc2ee1c8be24c9'
X--- Makefile.orig	2014-11-22 17:46:35.000000000 +0200
X+++ Makefile	2014-11-22 17:49:13.000000000 +0200
X@@ -1,8 +1,6 @@
X-LDFLAGS = `sh osflags ld $(MODE)`
X-CFLAGS = -c -g `sh osflags c $(MODE)`
X-TUN_DEV_FILE = `sh osflags dev $(MODE)`
X-GCC = gcc
X-GPP = g++
X+TUN_DEV_FILE = src/tun_dev_freebsd.c
X+GCC = ${CC}
X+GPP = ${CXX}
X 
X .PHONY: directories
X 
X@@ -16,46 +14,46 @@
X tunemu.o: directories build/tunemu.o
X 
X hans: build/tun.o build/sha1.o build/main.o build/client.o build/server.o build/auth.o build/worker.o build/time.o build/tun_dev.o build/echo.o build/exception.o build/utility.o
X-	$(GPP) -o hans build/tun.o build/sha1.o build/main.o build/client.o build/server.o build/auth.o build/worker.o build/time.o build/tun_dev.o build/echo.o build/exception.o build/utility.o $(LDFLAGS)
X+	${GPP} -o hans build/tun.o build/sha1.o build/main.o build/client.o build/server.o build/auth.o build/worker.o build/time.o build/tun_dev.o build/echo.o build/exception.o build/utility.o $(LDFLAGS)
X 
X build/utility.o: src/utility.cpp src/utility.h
X-	$(GPP) -c src/utility.cpp -o $@ -o $@ $(CFLAGS)
X+	${GPP} -c src/utility.cpp -o $@ -o $@ ${CFLAGS}
X 
X build/exception.o: src/exception.cpp src/exception.h
X-	$(GPP) -c src/exception.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/exception.cpp -o $@ ${CFLAGS}
X 
X build/echo.o: src/echo.cpp src/echo.h src/exception.h
X-	$(GPP) -c src/echo.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/echo.cpp -o $@ ${CFLAGS}
X 
X build/tun.o: src/tun.cpp src/tun.h src/exception.h src/utility.h src/tun_dev.h
X-	$(GPP) -c src/tun.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/tun.cpp -o $@ ${CFLAGS}
X 
X build/tun_dev.o:
X-	$(GCC) -c $(TUN_DEV_FILE) -o build/tun_dev.o -o $@ $(CFLAGS)
X+	${GCC} -c ${TUN_DEV_FILE} -o build/tun_dev.o -o $@ ${CFLAGS}
X 
X build/sha1.o: src/sha1.cpp src/sha1.h
X-	$(GPP) -c src/sha1.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/sha1.cpp -o $@ ${CFLAGS}
X 
X build/main.o: src/main.cpp src/client.h src/server.h src/exception.h src/worker.h src/auth.h src/time.h src/echo.h src/tun.h src/tun_dev.h
X-	$(GPP) -c src/main.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/main.cpp -o $@ ${CFLAGS}
X 
X build/client.o: src/client.cpp src/client.h src/server.h src/exception.h src/config.h src/worker.h src/auth.h src/time.h src/echo.h src/tun.h src/tun_dev.h
X-	$(GPP) -c src/client.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/client.cpp -o $@ ${CFLAGS}
X 
X build/server.o: src/server.cpp src/server.h src/client.h src/utility.h src/config.h src/worker.h src/auth.h src/time.h src/echo.h src/tun.h src/tun_dev.h
X-	$(GPP) -c src/server.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/server.cpp -o $@ ${CFLAGS}
X 
X build/auth.o: src/auth.cpp src/auth.h src/sha1.h src/utility.h
X-	$(GPP) -c src/auth.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/auth.cpp -o $@ ${CFLAGS}
X 
X build/worker.o: src/worker.cpp src/worker.h src/tun.h src/exception.h src/time.h src/echo.h src/tun_dev.h src/config.h
X-	$(GPP) -c src/worker.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/worker.cpp -o $@ ${CFLAGS}
X 
X build/time.o: src/time.cpp src/time.h
X-	$(GPP) -c src/time.cpp -o $@ $(CFLAGS)
X+	${GPP} -c src/time.cpp -o $@ ${CFLAGS}
X 
X clean:
X 	rm -rf build hans
X 
X build/tunemu.o: src/tunemu.h src/tunemu.c
X-	$(GCC) -c src/tunemu.c -o build/tunemu.o
X+	${GCC} -c src/tunemu.c -o build/tunemu.o
00f1877f7d4533cd6adc2ee1c8be24c9
echo x - hanstunnel/files/patch-tun.cpp
sed 's/^X//' >hanstunnel/files/patch-tun.cpp << '0a4216e67650c84929001f6d046ecbda'
X--- src/tun.cpp.orig	2014-02-07 05:36:31.000000000 +0200
X+++ src/tun.cpp	2014-11-22 17:31:16.000000000 +0200
X@@ -20,7 +20,7 @@
X #include "tun.h"
X #include "exception.h"
X #include "utility.h"
X-
X+#include <sys/types.h>
X #include <arpa/inet.h>
X #include <netinet/in_systm.h>
X #include <netinet/in.h>
X@@ -69,23 +69,17 @@
X     string ips = Utility::formatIp(ip);
X     string destIps = Utility::formatIp(destIp);
X 
X-#ifdef LINUX
X-    snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s netmask 255.255.255.0", device, ips.c_str());
X-#else
X-    snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.255", device, ips.c_str(), destIps.c_str());
X-#endif
X+    snprintf(cmdline, sizeof(cmdline), "/sbin/ifconfig %s %s %s netmask 255.255.255.0", device, ips.c_str(), destIps.c_str());
X 
X     if (system(cmdline) != 0)
X         syslog(LOG_ERR, "could not set tun device ip address");
X 
X-#ifndef LINUX
X     if (includeSubnet)
X     {
X         snprintf(cmdline, sizeof(cmdline), "/sbin/route add %s/24 %s", destIps.c_str(), destIps.c_str());
X         if (system(cmdline) != 0)
X             syslog(LOG_ERR, "could not add route");
X     }
X-#endif
X }
X 
X void Tun::write(const char *buffer, int length)
0a4216e67650c84929001f6d046ecbda
echo x - hanstunnel/files/patch-echo.cpp
sed 's/^X//' >hanstunnel/files/patch-echo.cpp << 'c9aaa09cd5c270680d478f955bb4582b'
X--- src/echo.cpp.orig	2014-11-22 17:51:42.000000000 +0200
X+++ src/echo.cpp	2014-11-22 17:51:46.000000000 +0200
X@@ -19,7 +19,7 @@
X 
X #include "echo.h"
X #include "exception.h"
X-
X+#include <sys/types.h>
X #include <sys/socket.h>
X #include <netinet/in_systm.h>
X #include <netinet/in.h>
c9aaa09cd5c270680d478f955bb4582b
echo x - hanstunnel/pkg-message
sed 's/^X//' >hanstunnel/pkg-message << '35a6976a3b2d8f949619ff80f5876ac6'
X------------------------------------------------------------
X
XHans runs on Linux as a client and a server.
XIt runs on FreeBSD client only.
X
XNOTE: that Hans can not receive echo requests on BSD systems.
XTherefore the server only works on Linux.
X
X------------------------------------------------------------
X
X### Running as a server ###
X
X% hans -s 10.1.2.0 -r -p password -u nobody
X
X### Running as a client ###
X
X% hans -c server_address -p password -u nobody
X
X### Help ###
X
X% hans
X
X------------------------------------------------------------
35a6976a3b2d8f949619ff80f5876ac6
echo x - hanstunnel/pkg-descr
sed 's/^X//' >hanstunnel/pkg-descr << 'b3d8e535b1ab66b72469a8c0f03d82f8'
XHans makes it possible to tunnel IPv4 through ICMP echo packets, so you
Xcould call it a ping tunnel. This can be useful when you find yourself
Xin the situation that your Internet access is firewalled, but pings are
Xallowed.
X
XHans runs on Linux as a client and a server. It runs on Mac OS X,
XiPhone/iPod touch, FreeBSD and OpenBSD as a client only.
X
X
XWWW: http://code.gerade.org/hans/
b3d8e535b1ab66b72469a8c0f03d82f8
exit
Comment 1 vsityz 2015-01-05 11:05:24 UTC
Created attachment 151349 [details]
hanstunnel port

Fix build in FreeBSD 8
Comment 2 Shaun Amott freebsd_committer 2015-01-28 13:52:06 UTC
- Could you explain the purpose of the CLANG option? If the port now builds with gcc, then ideally there should be no reason for the OPTIONS machinery.

- Would you mind resubmitting this as a diff file?
Comment 3 Jan Beich freebsd_committer 2015-04-23 13:51:26 UTC
To be ovehauled in bug 195313.

*** This bug has been marked as a duplicate of bug 195313 ***