diff options
author | kris <kris@FreeBSD.org> | 2001-08-25 17:55:44 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-08-25 17:55:44 +0800 |
commit | 8a4568a57142063fca982b18e89d83e8d33048be (patch) | |
tree | cb3741bf95915afc9d482b0bf26a18ce93194906 /astro/xworld | |
parent | 69fe2f181c88dc905eed03fc779d8c569f6c7351 (diff) | |
download | freebsd-ports-gnome-8a4568a57142063fca982b18e89d83e8d33048be.tar.gz freebsd-ports-gnome-8a4568a57142063fca982b18e89d83e8d33048be.tar.zst freebsd-ports-gnome-8a4568a57142063fca982b18e89d83e8d33048be.zip |
Add xworld-2.0
XWorld displays a pretty picture of our earth as it would look if
viewed from the direction of the sun. The window is regularly updated.
You can use xworld in lieu of a clock.
Obtained from: OpenBSD
Diffstat (limited to 'astro/xworld')
-rw-r--r-- | astro/xworld/Makefile | 27 | ||||
-rw-r--r-- | astro/xworld/distinfo | 1 | ||||
-rw-r--r-- | astro/xworld/files/patch-xworld_c | 140 | ||||
-rw-r--r-- | astro/xworld/pkg-comment | 1 | ||||
-rw-r--r-- | astro/xworld/pkg-descr | 3 | ||||
-rw-r--r-- | astro/xworld/pkg-plist | 1 |
6 files changed, 173 insertions, 0 deletions
diff --git a/astro/xworld/Makefile b/astro/xworld/Makefile new file mode 100644 index 000000000000..a0340918af1d --- /dev/null +++ b/astro/xworld/Makefile @@ -0,0 +1,27 @@ +# Ports collection makefile for: xworld +# Date created: 24 Aug 2001 +# Whom: Kris Kennaway <kris@FreeBSD.org +# +# $FreeBSD$ +# + +PORTNAME= xworld +PORTVERSION= 2.0 +CATEGORIES= astro +MASTER_SITES= ftp://gutemine.geo.uni-koeln.de/pub/xworld/ \ + ftp://ftp.Uni-Koeln.DE/misc/ + +MAINTAINER= ports@FreeBSD.org + +HAS_CONFIGURE= yes +CONFIGURE_ENV= CAT=${CAT} \ + STRIP=/usr/bin/strip \ + INCLUDES="-I${X11BASE}/include" \ + LDLIBS="-lm -L${X11BASE}/lib -lX11" \ + MORELIBS="" +STRIP= #don't strip out image data on install + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/xworld ${PREFIX}/bin + +.include <bsd.port.mk> diff --git a/astro/xworld/distinfo b/astro/xworld/distinfo new file mode 100644 index 000000000000..195b7c74ac1f --- /dev/null +++ b/astro/xworld/distinfo @@ -0,0 +1 @@ +MD5 (xworld-2.0.tar.gz) = 226cbd2b0698d8d9e5f56851d9c90e5e diff --git a/astro/xworld/files/patch-xworld_c b/astro/xworld/files/patch-xworld_c new file mode 100644 index 000000000000..63cc59e8a531 --- /dev/null +++ b/astro/xworld/files/patch-xworld_c @@ -0,0 +1,140 @@ +--- xworld.c.orig Wed Jul 28 17:39:11 1999 ++++ xworld.c Sat Aug 11 21:23:01 2001 +@@ -63,6 +63,8 @@ + #define BORDER 5 + #define SLEEP 120 + ++#define MIN(x,y) (((x)<(y))?(x):(y)) ++ + char *MainTitle[] = {"Hello, world"}; + char *IconTitle[] = {"xworld"}; + +@@ -92,6 +94,26 @@ usage() + exit(1); + } + ++ ++static char * ++alloc_image(XImage *image) ++{ ++ char *Map; ++ int ix, iy, j; ++ Map = (char *)malloc(image->height * image->bytes_per_line); ++ if (Map == NULL) { ++ fprintf(stderr, "xworld: not enough memory\n"); ++ exit(1); ++ } ++ image->data = Map; ++ ++ for(j = 0, ix = 0; ix < image->width; ix++) ++ for (iy = 0; iy < image->height; iy++) ++ XPutPixel(image, ix, iy, j++ % NCOLORS); ++ ++ return Map; ++} ++ + int + main(int argc, char **argv) + { +@@ -305,29 +327,16 @@ main(int argc, char **argv) + xcolor[i].blue = color[i].blue; + if (XAllocColor(display, cmap, &xcolor[i]) == 0) { + fprintf(stderr, "xworld: can't allocate colors\n"); ++#if 0 + exit(-1); ++#endif + } + } + + /* + * generate startup image + */ +- Map = (char *)malloc(size*size*sizeof(char)); +- if (Map == NULL) { +- fprintf(stderr, "xworld: not enough memory\n"); +- exit(1); +- } +- +- j = 0; +- for (iy = 0; iy < size; iy++) { +- i = iy % (NCOLORS + 1); +- for (ix = 0; ix < size; ix++) { +- *(Map + j++) = xcolor[i].pixel; +- if (i++ >= NCOLORS) i = 0; +- } +- } +- +- image->data = Map; ++ Map = alloc_image(image); + + gc = XCreateGC(display, win, 0, 0); + +@@ -414,21 +423,21 @@ main(int argc, char **argv) + * Map elevations to colors + */ + if (i != SOK) { +- *(Map + j) = xcolor[BLACK].pixel; ++ XPutPixel(image, ix, iy, xcolor[BLACK].pixel); + continue; + } + if (Value > level[NLEVELS - 1]) { +- *(Map + j) = xcolor[HIGH].pixel; ++ XPutPixel(image, ix, iy, xcolor[HIGH].pixel); + continue; + } + for (i = 0; i <= NLEVELS - 1; i++) { + if (Value <= level[i]) { +- *(Map + j) = xcolor[i].pixel; ++ XPutPixel(image, ix, iy, xcolor[i].pixel); + break; + } + } + } else +- *(Map + j) = xcolor[BLACK].pixel; ++ XPutPixel(image, ix, iy, xcolor[BLACK].pixel); + } + } + XPutImage(display, win, gc, image, 0, 0, 0, 0, size, size); +@@ -444,8 +453,12 @@ main(int argc, char **argv) + ConfigureEvent = (XConfigureEvent *)&event; + size = ConfigureEvent->width; + if (ConfigureEvent->height != size) { ++#if 0 + fprintf(stderr, "xworld: error: width != height\n"); + exit(1); ++#else ++ size = MIN(size, ConfigureEvent->height); ++#endif + } + if (size != old_size) { + old_size = size; +@@ -453,28 +466,14 @@ main(int argc, char **argv) + r1 = n/2; + r2 = size/2; + XDestroyImage(image); +- free(Map); + image = XCreateImage(display, visual, depth, format, + 0, 0, size, size, bitmap_pad, 0); + if (image == NULL) { + fprintf(stderr, "xworld: can't create XImage\n"); + exit(1); + } +- Map = (char *)malloc(size*size*sizeof(char)); +- if (Map == NULL) { +- fprintf(stderr, "xworld: not enough memory\n"); +- exit(1); +- } +- image->data = Map; ++ Map = alloc_image(image); + +- j = 0; +- for (iy = 0; iy < size; iy++) { +- i = iy % (NCOLORS + 1); +- for (ix = 0; ix < size; ix++) { +- *(Map + j++) = xcolor[i].pixel; +- if (i++ >= NCOLORS) i = 0; +- } +- } + XPutImage(display, win, gc, image, 0, 0, 0, 0, + size, size); + break; diff --git a/astro/xworld/pkg-comment b/astro/xworld/pkg-comment new file mode 100644 index 000000000000..ec23472901ce --- /dev/null +++ b/astro/xworld/pkg-comment @@ -0,0 +1 @@ +Earth as seen from the direction of the sun diff --git a/astro/xworld/pkg-descr b/astro/xworld/pkg-descr new file mode 100644 index 000000000000..69615586e314 --- /dev/null +++ b/astro/xworld/pkg-descr @@ -0,0 +1,3 @@ +XWorld displays a pretty picture of our earth as it would look if +viewed from the direction of the sun. The window is regularly updated. +You can use xworld in lieu of a clock. diff --git a/astro/xworld/pkg-plist b/astro/xworld/pkg-plist new file mode 100644 index 000000000000..efe8c508b8c2 --- /dev/null +++ b/astro/xworld/pkg-plist @@ -0,0 +1 @@ +bin/xworld |