miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Minor FreeBSD related patches

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Feature Request
View previous topic :: View next topic  
Author Message
Squat



Joined: 15 Jan 2008
Posts: 4
Location: Trondheim, Norway

PostPosted: Wed May 30, 2012 9:40 am    Post subject: Minor FreeBSD related patches Reply with quote

I am maintaining the FreeBSD port of miniupnpd, and the port has implemented a two FreeBSD related patches.
Some of this should probably instead be moved upwards to the official version of miniupnpd?

The patches are the following:
Code:
--- Makefile.orig       2012-05-30 10:27:24.587226775 +0200
+++ Makefile    2012-05-30 10:28:12.497226510 +0200
@@ -15,7 +15,7 @@
 # $ CONFIG_OPTIONS="--ipv6 --igd2" make
 #
 
-CFLAGS ?= -pipe -Os
+CFLAGS ?= -pipe
 #CFLAGS = -pipe -O -g -DDEBUG
 CFLAGS += -ansi
 CFLAGS += -Wall
@@ -43,10 +43,12 @@
 
 # better way to find if we are using ipf or pf
 .if $(OSNAME) == "FreeBSD"
+.if defined(/etc/rc.subr) && defined(/etc/rc.conf)
 FWNAME != . /etc/rc.subr; . /etc/rc.conf; \
           if checkyesno ipfilter_enable; then \
           echo "ipf"; else echo "pf"; fi
 .endif
+.endif
 
 .if $(OSNAME) == "NetBSD"
 FWNAME != . /etc/rc.subr; . /etc/rc.conf; \


The -Os should probably stay unchanged in the official version, while the FreeBSD-port removes it to replace it with what ports (FreeBSD) passes in by it self (for me it is -O2, I guess it comes from options in /etc/make.conf).

The other change is to check if /etc/rc.conf and /etc/rc.subr exist.
I mean that this just as well should be a part of the official version, instead of a local change in the FreeBSD port.
If one wants to use variables from those files it is a good idea to check if they exists first, as checkyesno dislike checking for variables if the source does not exist.
This is mostly relevant when trying to build the port in tinderbox or other "non fully environments".

The same is the point of the other patch:
Code:
--- genconfig.sh.orig   2012-05-30 10:37:23.936226718 +0200
+++ genconfig.sh        2012-05-30 10:36:53.849226834 +0200
@@ -112,21 +112,23 @@
                # new way to see which one to use PF or IPF.
                # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=957
                # source file with handy subroutines like checkyesno
-               . /etc/rc.subr
-               # source config file so we can probe vars
-               . /etc/rc.conf
-               if checkyesno ipfilter_enable; then
-                       echo "Using ipf"
-                       FW=ipf
-               elif checkyesno pf_enable; then
-                       echo "Using pf"
-                       FW=pf
-               elif checkyesno firewall_enable; then
-                       echo "Using ifpw"
-                       FW=ipfw
-               else
-                       echo "Could not detect usage of ipf, pf, ipfw. Compiling for pf by default"
-                       FW=pf
+               if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ]; then
+                       . /etc/rc.subr
+                       # source config file so we can probe vars
+                       . /etc/rc.conf
+                       if checkyesno ipfilter_enable; then
+                               echo "Using ipf"
+                               FW=ipf
+                       elif checkyesno pf_enable; then
+                               echo "Using pf"
+                               FW=pf
+                       elif checkyesno firewall_enable; then
+                               echo "Using ifpw"
+                               FW=ipfw
+                       else
+                               echo "Could not detect usage of ipf, pf, ipfw. Compiling for pf by default"
+                               FW=pf
+                       fi
                fi
                echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                OS_URL=http://www.freebsd.org/
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1445

PostPosted: Wed May 30, 2012 12:34 pm    Post subject: Reply with quote

Thank you for the patch.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Feature Request All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.