From 0bd053ea18da72bfd2057e4397740a1e8f4d32c8 Mon Sep 17 00:00:00 2001 From: Andreas Proschofsky Date: Fri, 21 Sep 2007 15:41:31 +0000 Subject: Split intlclock out into its own package svn path=/; revision=27 --- gnome-extra/intlclock-applet/Manifest | 12 + .../files/intlclock-sunpos-gpl.patch | 508 +++++++++++++++++++++ .../intlclock-applet/intlclock-applet-1.0.ebuild | 42 ++ 3 files changed, 562 insertions(+) create mode 100644 gnome-extra/intlclock-applet/Manifest create mode 100644 gnome-extra/intlclock-applet/files/intlclock-sunpos-gpl.patch create mode 100644 gnome-extra/intlclock-applet/intlclock-applet-1.0.ebuild (limited to 'gnome-extra') diff --git a/gnome-extra/intlclock-applet/Manifest b/gnome-extra/intlclock-applet/Manifest new file mode 100644 index 0000000..d4b47d4 --- /dev/null +++ b/gnome-extra/intlclock-applet/Manifest @@ -0,0 +1,12 @@ +AUX intlclock-sunpos-gpl.patch 16071 RMD160 76a00b20a18a7b0d4dacf28bbfdf4f8ca00ffe7c SHA1 e69cd3cfc03a1d2d291e10f16450e7a466a0b892 SHA256 680a55ecd34ad2021c085d45f8255c514ef80a22d77bda2e6075141678c1d419 +MD5 2066ccd2e7bffad1203f2abbe7648888 files/intlclock-sunpos-gpl.patch 16071 +RMD160 76a00b20a18a7b0d4dacf28bbfdf4f8ca00ffe7c files/intlclock-sunpos-gpl.patch 16071 +SHA256 680a55ecd34ad2021c085d45f8255c514ef80a22d77bda2e6075141678c1d419 files/intlclock-sunpos-gpl.patch 16071 +DIST intlclock-1.0.tar.gz 605354 RMD160 d463895c794c2dc19f1bd6169903984063369f4b SHA1 29b61d0108a49b2e415aaeb2b71b58ef7804a47f SHA256 8848af9c052c45c5b6304143a22b9ef01d1249db66b30bf0cfdea499a13c7f3a +EBUILD intlclock-applet-1.0.ebuild 993 RMD160 673891b1366c84c4a18d2cca0114a0c6144dfe44 SHA1 ef6b0fa8df7effdae5b95b710d349ec8d5770805 SHA256 42c4061d1f062d3339e1910e7443b79585de24eeb7e75b79c7aa9057a6d6990f +MD5 8bc352f3075ac9fc64ac1dcabda384d2 intlclock-applet-1.0.ebuild 993 +RMD160 673891b1366c84c4a18d2cca0114a0c6144dfe44 intlclock-applet-1.0.ebuild 993 +SHA256 42c4061d1f062d3339e1910e7443b79585de24eeb7e75b79c7aa9057a6d6990f intlclock-applet-1.0.ebuild 993 +MD5 023771a1f08e7b1cfe6320a7496d9cb6 files/digest-intlclock-applet-1.0 241 +RMD160 3e6ac668649d3ee94e2a9b2e302c255b8590815e files/digest-intlclock-applet-1.0 241 +SHA256 9cffc1a24561f00c8181459d53b0153f76790d84fdc811a5f383354c7fc8f62d files/digest-intlclock-applet-1.0 241 diff --git a/gnome-extra/intlclock-applet/files/intlclock-sunpos-gpl.patch b/gnome-extra/intlclock-applet/files/intlclock-sunpos-gpl.patch new file mode 100644 index 0000000..7e8178b --- /dev/null +++ b/gnome-extra/intlclock-applet/files/intlclock-sunpos-gpl.patch @@ -0,0 +1,508 @@ +--- src/intlclock-map.c ++++ src/intlclock-map.c +@@ -516,7 +516,7 @@ + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + +- sun_position (now, &sun_lat, &sun_lon); ++ get_sun_position (now, &sun_lat, &sun_lon); + + for (y = 0; y < height; y++) { + gdouble lat = (height / 2.0 - y) / (height / 2.0) * 90.0; +--- src/intlclock-sunpos.c ++++ src/intlclock-sunpos.c +@@ -1,348 +1,189 @@ + /* +- * sunpos.c +- * kirk johnson +- * july 1993 ++ * Copyright (C) 2007 Red Hat, Inc. + * +- * includes revisions from Frank T. Solensky, february 1999 ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * +- * code for calculating the position on the earth's surface for which +- * the sun is directly overhead (adapted from _practical astronomy +- * with your calculator, third edition_, peter duffett-smith, +- * cambridge university press, 1988.) +- * +- * Copyright (C) 1989, 1990, 1993-1995, 1999 Kirk Lauritz Johnson +- * +- * Parts of the source code (as marked) are: +- * Copyright (C) 1989, 1990, 1991 by Jim Frost +- * Copyright (C) 1992 by Jamie Zawinski +- * +- * Permission to use, copy, modify and freely distribute xearth for +- * non-commercial and not-for-profit purposes is hereby granted +- * without fee, provided that both the above copyright notice and this +- * permission notice appear in all copies and in supporting +- * documentation. +- * +- * Unisys Corporation holds worldwide patent rights on the Lempel Zev +- * Welch (LZW) compression technique employed in the CompuServe GIF +- * image file format as well as in other formats. Unisys has made it +- * clear, however, that it does not require licensing or fees to be +- * paid for freely distributed, non-commercial applications (such as +- * xearth) that employ LZW/GIF technology. Those wishing further +- * information about licensing the LZW patent should contact Unisys +- * directly at (lzw_info@unisys.com) or by writing to +- * +- * Unisys Corporation +- * Welch Licensing Department +- * M/S-C1SW19 +- * P.O. Box 500 +- * Blue Bell, PA 19424 +- * +- * The author makes no representations about the suitability of this +- * software for any purpose. It is provided "as is" without express or +- * implied warranty. +- * +- * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, +- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT +- * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +- */ +- +-#include +-#include +-#include +- +-#include "intlclock-sunpos.h" +- +-#define TWOPI (2*M_PI) +-#define DegsToRads(x) ((x)*(TWOPI/360)) +- +-/* +- * the epoch upon which these astronomical calculations are based is +- * 1990 january 0.0, 631065600 seconds since the beginning of the +- * "unix epoch" (00:00:00 GMT, Jan. 1, 1970) +- * +- * given a number of seconds since the start of the unix epoch, +- * DaysSinceEpoch() computes the number of days since the start of the +- * astronomical epoch (1990 january 0.0) ++ * AUTHORS: Jonathan Blandford , Matthias Clasen + */ + +-#define EpochStart (631065600) +-#define DaysSinceEpoch(secs) (((secs)-EpochStart)*(1.0/(24*3600))) + +-/* +- * assuming the apparent orbit of the sun about the earth is circular, +- * the rate at which the orbit progresses is given by RadsPerDay -- +- * TWOPI radians per orbit divided by 365.242191 days per year: +- */ +- +-#define RadsPerDay (TWOPI/365.242191) ++#include ++#include ++#include + +-/* +- * details of sun's apparent orbit at epoch 1990.0 (after +- * duffett-smith, table 6, section 46) +- * +- * Epsilon_g (ecliptic longitude at epoch 1990.0) 279.403303 degrees +- * OmegaBar_g (ecliptic longitude of perigee) 282.768422 degrees +- * Eccentricity (eccentricity of orbit) 0.016713 ++/* Calculated with the methods and figures from "Practical Astronomy With Your ++ * Calculator, version 3" by Peter Duffet-Smith. + */ ++/* Table 6. Details of the Sun's apparent orbit at epoch 1990.0 */ + +-#define Epsilon_g (DegsToRads(279.403303)) +-#define OmegaBar_g (DegsToRads(282.768422)) +-#define Eccentricity (0.016713) ++#define EPOCH 2447891.5 /* days */ /* epoch 1990 */ ++#define UNIX_EPOCH 2440586.5 /* days */ /* epoch 1970 */ ++#define EPSILON_G 279.403303 /* degrees */ /* ecliptic longitude at epoch 1990.0 */ ++#define PI_G 282.768422 /* degrees */ /* ecliptic longitude at perigree */ ++#define ECCENTRICITY 0.016713 /* eccentricity of orbit */ ++#define R_0 149598500 /* km */ /* semi-major access */ ++#define THETA_0 0.533128 /* degrees */ /* angular diameter at r = r_0 */ ++#define MEAN_OBLIQUITY 23.440592 /* degrees */ /* mean obliquity of earths axis at epoch 1990.0 */ + +-/* +- * MeanObliquity gives the mean obliquity of the earth's axis at epoch +- * 1990.0 (computed as 23.440592 degrees according to the method given +- * in duffett-smith, section 27) +- */ +-#define MeanObliquity (23.440592*(TWOPI/360)) ++/* Constrain x to 0-360 degrees */ ++#define NORMALIZE(x) \ ++ while (x>360) x-=360; while (x<0) x+= 360; + +-/* +- * Lunar parameters, epoch January 0, 1990.0 +- */ +-#define MoonMeanLongitude DegsToRads(318.351648) +-#define MoonMeanLongitudePerigee DegsToRads( 36.340410) +-#define MoonMeanLongitudeNode DegsToRads(318.510107) +-#define MoonInclination DegsToRads( 5.145396) ++#define DEG_TO_RADS(x) \ ++ (x * G_PI/180.0) + +-#define SideralMonth (27.3217) ++#define RADS_TO_DEG(x) \ ++ (x * 180.0/G_PI) + +-/* +- * Force an angular value into the range [-PI, +PI] +- */ +-#define Normalize(x) \ +- do { \ +- if ((x) < -M_PI) \ +- do (x) += TWOPI; while ((x) < -M_PI); \ +- else if ((x) > M_PI) \ +- do (x) -= TWOPI; while ((x) > M_PI); \ +- } while (0) +- +-static double solve_keplers_equation (double); +-static double mean_sun (double); +-static double sun_ecliptic_longitude (time_t); +-static void ecliptic_to_equatorial (double, double, double *, double *); +-static double julian_date (int, int, int); +-static double GST (time_t); +- +-/* +- * solve Kepler's equation via Newton's method +- * (after duffett-smith, section 47) ++/* Calculate number of days since 4713BC. + */ +-static double solve_keplers_equation(M) +- double M; ++static gdouble ++unix_time_to_julian_date (gint unix_time) + { +- double E; +- double delta; +- +- E = M; +- while (1) +- { +- delta = E - Eccentricity*sin(E) - M; +- if (fabs(delta) <= 1e-10) break; +- E -= delta / (1 - Eccentricity*cos(E)); +- } +- +- return E; ++ return UNIX_EPOCH + (double) unix_time / (60 * 60 * 24); + } + ++/* Finds an iterative solution for [ E - e sin (E) = M ] for values of e less ++ than 0.1. Page 90 */ + +-/* +- * Calculate the position of the mean sun: where the sun would +- * be if the earth's orbit were circular instead of ellipictal. +- */ ++#define ERROR_ACCURACY 1e-6 /* radians */ + +-static double mean_sun (D) +- double D; /* days since ephemeris epoch */ ++static gdouble ++solve_keplers_equation (gdouble e, ++ gdouble M) + { +- double N, M; ++ gdouble d, E; + +- N = RadsPerDay * D; +- N = fmod(N, TWOPI); +- if (N < 0) N += TWOPI; +- +- M = N + Epsilon_g - OmegaBar_g; +- if (M < 0) M += TWOPI; +- return M; +-} +- +-/* +- * compute ecliptic longitude of sun (in radians) +- * (after duffett-smith, section 47) +- */ +-static double sun_ecliptic_longitude(ssue) +- time_t ssue; /* seconds since unix epoch */ +-{ +- double D; +- double M_sun, E; +- double v; +- +- D = DaysSinceEpoch(ssue); +- M_sun = mean_sun(D); ++ /* start with an initial estimate */ ++ E = M; ++ ++ d = E - e * sin (E) - M; + +- E = solve_keplers_equation(M_sun); +- v = 2 * atan(sqrt((1+Eccentricity)/(1-Eccentricity)) * tan(E/2)); ++ while (ABS (d) > ERROR_ACCURACY) ++ { ++ E = E - (d / (1 - e * cos (E))); ++ d = E - e * sin (E) - M; ++ } + +- return (v + OmegaBar_g); ++ return E; + } + ++ /* convert the ecliptic longitude to right ascension and declination. Section 27. */ ++static void ++ecliptic_to_equatorial (gdouble lambda, ++ gdouble beta, ++ gdouble *ra, ++ gdouble *dec) ++{ ++ gdouble cos_mo; ++ gdouble sin_mo; ++ ++ g_assert (ra != NULL); ++ g_assert (dec != NULL); ++ ++ sin_mo = sin (DEG_TO_RADS (MEAN_OBLIQUITY)); ++ cos_mo = cos (DEG_TO_RADS (MEAN_OBLIQUITY)); ++ ++ *ra = atan2 (sin (lambda) * cos_mo - tan (beta) * sin_mo, cos (lambda)); ++ *dec = asin (sin (beta) * cos_mo + cos (beta) * sin_mo * sin (lambda)); ++} ++ ++/* calculate GST. Section 12 */ ++static gdouble ++greenwich_sidereal_time (gdouble unix_time) ++{ ++ gdouble u, JD, T, T0, UT; ++ ++ u = fmod (unix_time, 24 * 60 * 60); ++ JD = unix_time_to_julian_date (unix_time - u); ++ T = (JD - 2451545) / 36525; ++ T0 = 6.697374558 + (2400.051336 * T) + (0.000025862 * T * T); ++ T0 = fmod (T0, 24); ++ UT = u / (60 * 60); ++ T0 = T0 + UT * 1.002737909; ++ T0 = fmod (T0, 24); + +-/* +- * convert from ecliptic to equatorial coordinates +- * (after duffett-smith, section 27) +- */ +-static void ecliptic_to_equatorial(lambda, beta, alpha, delta) +- double lambda; /* ecliptic longitude */ +- double beta; /* ecliptic latitude */ +- double *alpha; /* (return) right ascension */ +- double *delta; /* (return) declination */ +-{ +- double sin_e, cos_e; +- +- sin_e = sin(MeanObliquity); +- cos_e = cos(MeanObliquity); +- +- *alpha = atan2(sin(lambda)*cos_e - tan(beta)*sin_e, cos(lambda)); +- *delta = asin(sin(beta)*cos_e + cos(beta)*sin_e*sin(lambda)); ++ return T0; + } + +- +-/* +- * computing julian dates (assuming gregorian calendar, thus this is +- * only valid for dates of 1582 oct 15 or later) +- * (after duffett-smith, section 4) +- */ +-static double julian_date(y, m, d) +- int y; /* year (e.g. 19xx) */ +- int m; /* month (jan=1, feb=2, ...) */ +- int d; /* day of month */ ++/* Calulate the position of the sun at a given time. pages 89-91 */ ++void ++get_sun_position (gint unix_time, gdouble *latitude, gdouble *longitude) + { +- int A, B, C, D; +- double JD; ++ gdouble jd, D, N, M, E, x, v, lambda; ++ gdouble ra, dec, lat, lon; ++ jd = unix_time_to_julian_date (unix_time); + +- /* lazy test to ensure gregorian calendar */ +- assert(y >= 1583); ++ /* Calculate number of days since the epoch */ ++ D = jd - EPOCH; + +- if ((m == 1) || (m == 2)) +- { +- y -= 1; +- m += 12; +- } +- +- A = y / 100; +- B = 2 - A + (A / 4); +- C = 365.25 * y; +- D = 30.6001 * (m + 1); ++ N = D*360/365.242191; + +- JD = B + C + D + d + 1720994.5; ++ /* noramlize to 0 - 360 degrees */ ++ NORMALIZE (N); + +- return JD; +-} ++ /* Step 4: */ ++ M = N + EPSILON_G - PI_G; ++ NORMALIZE (M); + ++ /* Step 5: convert to radians */ ++ M = DEG_TO_RADS (M); + +-/* +- * compute greenwich mean sidereal time (GST) corresponding to a given +- * number of seconds since the unix epoch +- * (after duffett-smith, section 12) +- */ +-static double GST(ssue) +- time_t ssue; /* seconds since unix epoch */ +-{ +- double JD; +- double T, T0; +- double UT; +- struct tm *tm; +- +- tm = gmtime(&ssue); ++ /* Step 6: */ ++ E = solve_keplers_equation (ECCENTRICITY, M); + +- JD = julian_date(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday); +- T = (JD - 2451545) / 36525; ++ /* Step 7: */ ++ x = sqrt ((1 + ECCENTRICITY)/(1 - ECCENTRICITY)) * tan (E/2); + +- T0 = ((T + 2.5862e-5) * T + 2400.051336) * T + 6.697374558; ++ /* Step 8, 9 */ ++ v = 2 * RADS_TO_DEG (atan (x)); ++ NORMALIZE (v); + +- T0 = fmod(T0, 24.0); +- if (T0 < 0) T0 += 24; ++ /* Step 10 */ ++ lambda = v + PI_G; ++ NORMALIZE (lambda); + +- UT = tm->tm_hour + (tm->tm_min + tm->tm_sec / 60.0) / 60.0; ++ /* convert the ecliptic longitude to right ascension and declination */ ++ ecliptic_to_equatorial (DEG_TO_RADS (lambda), 0.0, &ra, &dec); + +- T0 += UT * 1.002737909; +- T0 = fmod(T0, 24.0); +- if (T0 < 0) T0 += 24; ++ ra = ra - (G_PI/12) * greenwich_sidereal_time (unix_time); + +- return T0; ++ *longitude = RADS_TO_DEG (ra); ++ *latitude = RADS_TO_DEG (dec); ++/* ++ NORMALIZE (ra); ++ NORMALIZE (dec); ++*/ + } + +- + /* +- * given a particular time (expressed in seconds since the unix +- * epoch), compute position on the earth (lat, lon) such that sun is +- * directly overhead. +- */ +-void sun_position(ssue, lat, lon) +- time_t ssue; /* seconds since unix epoch */ +- double *lat; /* (return) latitude */ +- double *lon; /* (return) longitude */ ++int ++main (int argc, char *argv[]) + { +- double lambda; +- double alpha, delta; +- double tmp; +- +- lambda = sun_ecliptic_longitude(ssue); +- ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); +- +- tmp = alpha - (TWOPI/24)*GST(ssue); +- Normalize(tmp); +- *lon = tmp * (360/TWOPI); +- *lat = delta * (360/TWOPI); +-} ++ gint i; ++ gint now; ++ GTimeVal timeval; + ++ gtk_init (&argc, &argv); + +-/* +- * given a particular time (expressed in seconds since the unix +- * epoch), compute position on the earth (lat, lon) such that the +- * moon is directly overhead. +- * +- * Based on duffett-smith **2nd ed** section 61; combines some steps +- * into single expressions to reduce the number of extra variables. +- */ +-void moon_position(ssue, lat, lon) +- time_t ssue; /* seconds since unix epoch */ +- double *lat; /* (return) latitude */ +- double *lon; /* (return) longitude */ +-{ +- double lambda, beta; +- double D, L, Ms, Mm, N, Ev, Ae, Ec, alpha, delta; ++ g_get_current_time (&timeval); ++ now = timeval.tv_sec; ++ ++ for (i = 0; i < now; i += 15 * 60) ++ get_sun_position (i); + +- D = DaysSinceEpoch(ssue); +- lambda = sun_ecliptic_longitude(ssue); +- Ms = mean_sun(D); +- +- L = fmod(D/SideralMonth, 1.0)*TWOPI + MoonMeanLongitude; +- Normalize(L); +- Mm = L - DegsToRads(0.1114041*D) - MoonMeanLongitudePerigee; +- Normalize(Mm); +- N = MoonMeanLongitudeNode - DegsToRads(0.0529539*D); +- Normalize(N); +- Ev = DegsToRads(1.2739) * sin(2.0*(L-lambda)-Mm); +- Ae = DegsToRads(0.1858) * sin(Ms); +- Mm += Ev - Ae - DegsToRads(0.37)*sin(Ms); +- Ec = DegsToRads(6.2886) * sin(Mm); +- L += Ev + Ec - Ae + DegsToRads(0.214) * sin(2.0*Mm); +- L += DegsToRads(0.6583) * sin(2.0*(L-lambda)); +- N -= DegsToRads(0.16) * sin(Ms); +- +- L -= N; +- lambda =(fabs(cos(L)) < 1e-12) ? +- (N + sin(L) * cos(MoonInclination) * M_PI/2) : +- (N + atan2(sin(L) * cos(MoonInclination), cos(L))); +- Normalize(lambda); +- beta = asin(sin(L) * sin(MoonInclination)); +- ecliptic_to_equatorial(lambda, beta, &alpha, &delta); +- alpha -= (TWOPI/24)*GST(ssue); +- Normalize(alpha); +- *lon = alpha * (360/TWOPI); +- *lat = delta * (360/TWOPI); ++ return 0; + } ++*/ +--- src/intlclock-sunpos.h ++++ src/intlclock-sunpos.h +@@ -1 +1,2 @@ +-void sun_position(time_t ssue, double *lat, double *lon); ++void ++get_sun_position (gint unix_time, gdouble *latitude, gdouble *longitude); diff --git a/gnome-extra/intlclock-applet/intlclock-applet-1.0.ebuild b/gnome-extra/intlclock-applet/intlclock-applet-1.0.ebuild new file mode 100644 index 0000000..123bf4c --- /dev/null +++ b/gnome-extra/intlclock-applet/intlclock-applet-1.0.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/gnome-extra/fast-user-switch-applet/fast-user-switch-applet-2.18.0.ebuild,v 1.8 2007/08/28 19:34:07 jer Exp $ + +inherit eutils gnome2 + +DESCRIPTION="Enhanced international Clock for the GNOME Panel" +HOMEPAGE="http://www.gnome.org/" +MY_PN="intlclock" +MY_P="${MY_PN}-${PV}" +SRC_URI="http://dev.gentoo.org/~suka/files/${MY_P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="eds" + +RDEPEND=">=dev-libs/glib-2 + >=x11-libs/gtk+-2 + >=gnome-base/librsvg-2 + >=gnome-base/gconf-2 + >=gnome-base/gnome-panel-2.0 + >=gnome-base/libgnome-2 + eds? ( >=gnome-extra/evolution-data-server-1.6 )" + +DEPEND="${RDEPEND}" + +DOCS="AUTHORS ChangeLog NEWS README" +USE_DESTDIR="1" + +pkg_setup() { + GG2CONF="--disable-scrollkeeper $(use_enable eds)" +} + +src_unpack() { + unpack ${A} + cd ${S} + epatch ${FILESDIR}/${MY_PN}-sunpos-gpl.patch + + gnome2_omf_fix +} -- cgit v1.2.3-65-gdbad