diff options
author | pav <pav@FreeBSD.org> | 2004-11-06 20:00:12 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2004-11-06 20:00:12 +0800 |
commit | 48447ccc5694cd85b8720d9ecf35b700d25bf931 (patch) | |
tree | fb89337cd2f4bece0ffaaa6966c279356c955c8d /misc | |
parent | ac23eac89a3212643b721b4a4a8c5e134ab4570f (diff) | |
download | freebsd-ports-gnome-48447ccc5694cd85b8720d9ecf35b700d25bf931.tar.gz freebsd-ports-gnome-48447ccc5694cd85b8720d9ecf35b700d25bf931.tar.zst freebsd-ports-gnome-48447ccc5694cd85b8720d9ecf35b700d25bf931.zip |
- Fix rounding/truncating functions on FreeBSD 4.x
- Simplify dependencies
Submitted by: Harald Wille <harald.wille@students.jku.at> (maintainer)
Diffstat (limited to 'misc')
-rw-r--r-- | misc/wmweather+/Makefile | 6 | ||||
-rw-r--r-- | misc/wmweather+/files/patch-convert.c | 121 | ||||
-rw-r--r-- | misc/wmweather+/files/patch-convert.h | 0 | ||||
-rw-r--r-- | misc/wmweather+/files/patch-forecast.c | 11 | ||||
-rw-r--r-- | misc/wmweather+/files/patch-metar.c | 12 | ||||
-rw-r--r-- | misc/wmweather+/files/patch-moon.c | 21 | ||||
-rw-r--r-- | misc/wmweather+/files/patch-subst.c | 0 |
7 files changed, 117 insertions, 54 deletions
diff --git a/misc/wmweather+/Makefile b/misc/wmweather+/Makefile index edc9b3232fd0..83adbec4b540 100644 --- a/misc/wmweather+/Makefile +++ b/misc/wmweather+/Makefile @@ -6,6 +6,7 @@ PORTNAME= wmweather+ PORTVERSION= 2.9 +PORTREVISION= 1 CATEGORIES= misc windowmaker MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= wmweatherplus @@ -13,12 +14,9 @@ MASTER_SITE_SUBDIR= wmweatherplus MAINTAINER= harald.wille@students.jku.at COMMENT= Think wmweather with forecasts, weather map, and a sky cond. display -LIB_DEPENDS= www[a-z]+:${PORTSDIR}/www/libwww \ - xmltok:${PORTSDIR}/www/libwww \ - xmlparse:${PORTSDIR}/www/libwww \ +LIB_DEPENDS= xmlparse:${PORTSDIR}/www/libwww \ wraster:${PORTSDIR}/x11-wm/windowmaker \ pcre:${PORTSDIR}/devel/pcre \ - Xpm:${PORTSDIR}/graphics/xpm \ tiff:${PORTSDIR}/graphics/tiff \ Hermes:${PORTSDIR}/graphics/Hermes \ png:${PORTSDIR}/graphics/png \ diff --git a/misc/wmweather+/files/patch-convert.c b/misc/wmweather+/files/patch-convert.c index c6c22ab66d82..3d8f115a9725 100644 --- a/misc/wmweather+/files/patch-convert.c +++ b/misc/wmweather+/files/patch-convert.c @@ -1,116 +1,161 @@ --- convert.c.orig Sun Sep 22 22:00:53 2002 -+++ convert.c Thu Jul 22 19:04:18 2004 -@@ -18,6 +18,9 @@ ++++ convert.c Fri Nov 5 22:19:11 2004 +@@ -18,6 +18,12 @@ */ #include <math.h> -+#ifndef NAN ++ ++#include <sys/param.h> ++#if (__FreeBSD_version < 500000) +#define NAN (0.0/0.0) +#endif ++ #if TM_IN_SYS_TIME # if TIME_WITH_SYS_TIME # include <sys/time.h> -@@ -52,7 +55,7 @@ +@@ -52,7 +58,11 @@ if(temp_C==999 || dewpt_C==999) return 999; f=1782.75*(dewpt_C-temp_C)/((237.7+dewpt_C)*(237.7+temp_C)); -- return round(pow(10, f+2)); -+ return rint(pow(10, f+2)); ++# if (__FreeBSD_version < 500000) ++ return floor(pow(10, f+2)+0.5); ++# else + return round(pow(10, f+2)); ++# endif } int rh_F(int temp_F, int dewpt_F){ -@@ -61,7 +64,7 @@ +@@ -61,7 +71,11 @@ if(temp_F==999 || dewpt_F==999) return 999; f=3208.95*(dewpt_F-temp_F)/((395.86+dewpt_F)*(395.86+temp_F)); -- return round(pow(10, f+2)); -+ return rint(pow(10, f+2)); ++# if (__FreeBSD_version < 500000) ++ return floor(pow(10, f+2)+0.5); ++# else + return round(pow(10, f+2)); ++# endif } int heatindex_C(int temp_C, int rh){ -@@ -75,7 +78,7 @@ +@@ -75,7 +89,11 @@ temp2=temp_C*temp_C; rh2=rh*rh; -- return round(16.18754948 + 2.900509394*temp_C - 0.0221545692*temp2 + 4.20938791*rh - 0.26300889*temp_C*rh + 0.0039811176*temp2*rh - 0.02956469*rh2 + 0.001305828*temp_C*rh2 - 6.4476e-06*temp2*rh2); -+ return rint(16.18754948 + 2.900509394*temp_C - 0.0221545692*temp2 + 4.20938791*rh - 0.26300889*temp_C*rh + 0.0039811176*temp2*rh - 0.02956469*rh2 + 0.001305828*temp_C*rh2 - 6.4476e-06*temp2*rh2); ++# if (__FreeBSD_version < 500000) ++ return floor(16.18754948 + 2.900509394*temp_C - 0.0221545692*temp2 + 4.20938791*rh - 0.26300889*temp_C*rh + 0.0039811176*temp2*rh - 0.02956469*rh2 + 0.001305828*temp_C*rh2 - 6.4476e-06*temp2*rh2+0.5); ++# else + return round(16.18754948 + 2.900509394*temp_C - 0.0221545692*temp2 + 4.20938791*rh - 0.26300889*temp_C*rh + 0.0039811176*temp2*rh - 0.02956469*rh2 + 0.001305828*temp_C*rh2 - 6.4476e-06*temp2*rh2); ++# endif #endif } -@@ -88,9 +91,9 @@ +@@ -88,9 +106,17 @@ temp3=temp2*temp_F; rh2=rh*rh; rh3=rh2*rh; -- return round(16.923 + .185212*temp_F + 5.37941*rh - .100254*temp_F*rh + (9.41695e-3)*temp2 + (7.28898e-3)*rh2 + (3.45372e-4)*temp2*rh - (8.14971e-4)*temp_F*rh2 + (1.02102e-5)*temp2*rh2 - (3.8646e-5)*temp3 + (2.91583e-5)*rh3 + (1.42721e-6)*temp3*rh + (1.97483e-7)*temp_F*rh3 - (2.18429e-8)*temp3*rh2 + (8.43296e-10)*temp2*rh3 - (4.81975e-11)*temp3*rh3); -+ return rint(16.923 + .185212*temp_F + 5.37941*rh - .100254*temp_F*rh + (9.41695e-3)*temp2 + (7.28898e-3)*rh2 + (3.45372e-4)*temp2*rh - (8.14971e-4)*temp_F*rh2 + (1.02102e-5)*temp2*rh2 - (3.8646e-5)*temp3 + (2.91583e-5)*rh3 + (1.42721e-6)*temp3*rh + (1.97483e-7)*temp_F*rh3 - (2.18429e-8)*temp3*rh2 + (8.43296e-10)*temp2*rh3 - (4.81975e-11)*temp3*rh3); ++# if (__FreeBSD_version < 500000) ++ return floor(16.923 + .185212*temp_F + 5.37941*rh - .100254*temp_F*rh + (9.41695e-3)*temp2 + (7.28898e-3)*rh2 + (3.45372e-4)*temp2*rh - (8.14971e-4)*temp_F*rh2 + (1.02102e-5)*temp2*rh2 - (3.8646e-5)*temp3 + (2.91583e-5)*rh3 + (1.42721e-6)*temp3*rh + (1.97483e-7)*temp_F*rh3 - (2.18429e-8)*temp3*rh2 + (8.43296e-10)*temp2*rh3 - (4.81975e-11)*temp3*rh3+0.5); ++# else + return round(16.923 + .185212*temp_F + 5.37941*rh - .100254*temp_F*rh + (9.41695e-3)*temp2 + (7.28898e-3)*rh2 + (3.45372e-4)*temp2*rh - (8.14971e-4)*temp_F*rh2 + (1.02102e-5)*temp2*rh2 - (3.8646e-5)*temp3 + (2.91583e-5)*rh3 + (1.42721e-6)*temp3*rh + (1.97483e-7)*temp_F*rh3 - (2.18429e-8)*temp3*rh2 + (8.43296e-10)*temp2*rh3 - (4.81975e-11)*temp3*rh3); ++# endif #if 0 -- return round(-42.379 + 2.04901523*temp_F + 10.14333127*rh - 0.22475541*temp_F*rh - .00683783*temp2 - .05481717*rh2 + .00122874*temp2*rh + .00085282*temp_F*rh2 - .00000199*temp2*rh2); -+ return rint(-42.379 + 2.04901523*temp_F + 10.14333127*rh - 0.22475541*temp_F*rh - .00683783*temp2 - .05481717*rh2 + .00122874*temp2*rh + .00085282*temp_F*rh2 - .00000199*temp2*rh2); ++# if (__FreeBSD_version < 500000) ++ return floor(-42.379 + 2.04901523*temp_F + 10.14333127*rh - 0.22475541*temp_F*rh - .00683783*temp2 - .05481717*rh2 + .00122874*temp2*rh + .00085282*temp_F*rh2 - .00000199*temp2*rh2+0.5); ++# else + return round(-42.379 + 2.04901523*temp_F + 10.14333127*rh - 0.22475541*temp_F*rh - .00683783*temp2 - .05481717*rh2 + .00122874*temp2*rh + .00085282*temp_F*rh2 - .00000199*temp2*rh2); ++# endif #endif } -@@ -106,14 +109,14 @@ +@@ -106,14 +132,22 @@ ret=35.74 + 0.6215*temp_F + (-35.75 + 0.4275*temp_F)*pow(windspeed*50292/57875.0, 0.16); if(ret>temp_F) return temp_F; -- return round(ret); -+ return rint(ret); ++# if (__FreeBSD_version < 500000) ++ return floor(ret+0.5); ++# else + return round(ret); ++# endif } /* Length Conversions */ int in2cm(int in){ if(in<0) return in; -- return round(in*2.54); -+ return rint(in*2.54); ++# if (__FreeBSD_version < 500000) ++ return floor(in*2.54+0.5); ++# else + return round(in*2.54); ++# endif } float m2mi(int meters){ -@@ -125,27 +128,27 @@ +@@ -125,27 +159,47 @@ int knots2mph(int knots){ if(knots<0) return knots; -- return round(knots*57875/50292.0); -+ return rint(knots*57875/50292.0); ++# if (__FreeBSD_version < 500000) ++ return floor(knots*57875/50292.0+0.5); ++# else + return round(knots*57875/50292.0); ++# endif } int knots2kph(int knots){ if(knots<0) return knots; -- return round(knots*463/250.0); -+ return rint(knots*463/250.0); ++# if (__FreeBSD_version < 500000) ++ return floor(knots*463/250.0+0.5); ++# else + return round(knots*463/250.0); ++# endif } int kph2knots(int kph){ if(kph<0) return kph; -- return round(kph*250/463.0); -+ return rint(kph*250/463.0); ++# if (__FreeBSD_version < 500000) ++ return floor(kph*250/463.0+0.5); ++# else + return round(kph*250/463.0); ++# endif } int knots2mps(int knots){ if(knots<0) return knots; -- return round(knots*463/900.0); -+ return rint(knots*463/900.0); ++# if (__FreeBSD_version < 500000) ++ return floor(knots*463/900.0+0.5); ++# else + return round(knots*463/900.0); ++# endif } int mps2knots(int mps){ if(mps<0) return mps; -- return round(mps*900/463.0); -+ return rint(mps*900/463.0); ++# if (__FreeBSD_version < 500000) ++ return floor(mps*900/463.0+0.5); ++# else + return round(mps*900/463.0); ++# endif } int knots2beaufort(int knots){ -@@ -170,12 +173,12 @@ +@@ -170,12 +224,20 @@ int temp_C2F(int temp_C){ if(temp_C==999) return 999; -- return round(temp_C*9/5.0+32); -+ return rint(temp_C*9/5.0+32); ++# if (__FreeBSD_version < 500000) ++ return floor(temp_C*9/5.0+32+0.5); ++# else + return round(temp_C*9/5.0+32); ++# endif } int temp_F2C(int temp_F){ if(temp_F==999) return 999; -- return round((temp_F-32)*5/9.0); -+ return rint((temp_F-32)*5/9.0); ++# if (__FreeBSD_version < 500000) ++ return floor((temp_F-32)*5/9.0+0.5); ++# else + return round((temp_F-32)*5/9.0); ++# endif } diff --git a/misc/wmweather+/files/patch-convert.h b/misc/wmweather+/files/patch-convert.h deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/misc/wmweather+/files/patch-convert.h +++ /dev/null diff --git a/misc/wmweather+/files/patch-forecast.c b/misc/wmweather+/files/patch-forecast.c index da9df8f09676..c22fe953789b 100644 --- a/misc/wmweather+/files/patch-forecast.c +++ b/misc/wmweather+/files/patch-forecast.c @@ -1,12 +1,15 @@ ---- forecast.orig Sun Mar 23 01:04:40 2003 -+++ forecast.c Wed Jul 28 11:43:58 2004 -@@ -36,6 +36,9 @@ +--- forecast.c.orig Sun Mar 23 01:04:40 2003 ++++ forecast.c Fri Nov 5 19:53:51 2004 +@@ -36,6 +36,12 @@ #include <string.h> #include <limits.h> #include <math.h> -+#ifndef NAN ++ ++#include <sys/param.h> ++#if (__FreeBSD_version < 500000) +#define NAN (0.0/0.0) +#endif ++ #include <pcre.h> #include "forecast.h" diff --git a/misc/wmweather+/files/patch-metar.c b/misc/wmweather+/files/patch-metar.c index 1dc32ff021ae..fb808e7d0f50 100644 --- a/misc/wmweather+/files/patch-metar.c +++ b/misc/wmweather+/files/patch-metar.c @@ -1,11 +1,15 @@ ---- metar.orig Sun Sep 22 22:00:53 2002 -+++ metar.c Wed Jul 28 11:44:50 2004 -@@ -36,6 +36,9 @@ +--- metar.c.orig Fri May 14 04:55:39 2004 ++++ metar.c Fri Nov 5 19:54:07 2004 +@@ -36,6 +36,12 @@ #include <string.h> #include <ctype.h> #include <math.h> -+#ifndef NAN ++ ++#include <sys/param.h> ++#if (__FreeBSD_version < 500000) +#define NAN (0.0/0.0) +#endif ++ #include <sys/stat.h> #include <sys/wait.h> + diff --git a/misc/wmweather+/files/patch-moon.c b/misc/wmweather+/files/patch-moon.c index 70800af73e0d..7d30a309cf47 100644 --- a/misc/wmweather+/files/patch-moon.c +++ b/misc/wmweather+/files/patch-moon.c @@ -1,11 +1,24 @@ ---- moon.c.old Fri May 14 04:55:39 2004 -+++ moon.c Thu Jul 22 17:26:25 2004 -@@ -44,7 +44,7 @@ +--- moon.c.orig Fri May 14 04:55:39 2004 ++++ moon.c Fri Nov 5 21:28:09 2004 +@@ -20,6 +20,7 @@ + /* One-line algorithm from http://www.moonstick.com/moon_phase_emergency.htm + * It's a bit rough, but it works well enough */ + ++#include <sys/param.h> + #if TM_IN_SYS_TIME + # if TIME_WITH_SYS_TIME + # include <sys/time.h> +@@ -44,7 +45,12 @@ #include "wmgeneral/wmgeneral-x11.h" static double fpart(double t){ - return t-trunc(t); -+ return rint(t); ++# if (__FreeBSD_version < 500000) ++ double integral; ++ return modf(t, &integral); ++# else ++ return t-trunc(t); ++# endif } double calc_moon(int month, int day, int year, int hm){ diff --git a/misc/wmweather+/files/patch-subst.c b/misc/wmweather+/files/patch-subst.c deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/misc/wmweather+/files/patch-subst.c +++ /dev/null |