1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

x11/xfishtank: upgrade to 2.5

Change upstream to use sources from debian package.

Add configuration to use xfishtank with xscreensaver
and made a hard link of xfishtank into xcreensaver hack dir.

PR:		    281458
Approved by:	<kidon@posteo.de> (maintainer)
This commit is contained in:
Rodrigo Osorio 2024-09-12 14:31:53 +02:00
parent 35258143f6
commit 8548b1e5ed
9 changed files with 250 additions and 347 deletions

View File

@ -1,18 +1,32 @@
PORTNAME= xfishtank
PORTVERSION= 2.2
PORTREVISION= 2
PORTVERSION= 2.5
CATEGORIES= x11
MASTER_SITES= http://cyber.dabamos.de/pub/distfiles/
MASTER_SITES= DEBIAN
MASTER_SITE_SUBDIR= pool/main/x/xfishtank/
DISTNAME= xfishtank_2.5.orig
MAINTAINER= kidon@posteo.de
COMMENT= Make fish swim in the background of your screen
WWW= https://sources.debian.org/src/xfishtank/2.5-1/README
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libImlib2.so:graphics/imlib2
PLIST_FILES= bin/xfishtank
USES= imake xorg
USE_XORG= x11 xext
WRKSRC= ${WRKDIR}/xfishtank2.0
WRKSRC= ${WRKDIR}/xfishtank-2.5
post-patch:
cd ${WRKDIR}/xfishtank2.0; make clean
XSSHACKSDIR= bin/xscreensaver-hacks
XSSCONFDIR= share/xscreensaver/config
pre-build:
${CC} ${WRKSRC}/makeh.c -o ${WRKSRC}/makeh
post-install:
${MKDIR} ${STAGEDIR}/${PREFIX}/${XSSHACKSDIR} ${STAGEDIR}/${PREFIX}/${XSSCONFDIR}
${CP} ${PATCHDIR}/${PORTNAME}.xml.in ${STAGEDIR}/${PREFIX}/${XSSCONFDIR}/${PORTNAME}.xml
(cd ${STAGEDIR}/${PREFIX}/${XSSHACKSDIR} ; ${LN} -f ${STAGEDIR}/${PREFIX}/bin/${PORTNAME} ${STAGEDIR}/${PREFIX}/${XSSHACKSDIR}/)
.include <bsd.port.mk>

View File

@ -1,2 +1,3 @@
SHA256 (xfishtank-2.2.tar.gz) = 4391228c074fccd73a9ea8332e090e92d79ba27f9e63693035f392387d03122c
SIZE (xfishtank-2.2.tar.gz) = 360031
TIMESTAMP = 1726130557
SHA256 (xfishtank_2.5.orig.tar.gz) = bd8ce3c4e7adb0e62b294de307972c0d5e2a442b094c178a3be084e3e26a08e0
SIZE (xfishtank_2.5.orig.tar.gz) = 153554

View File

@ -1,17 +1,9 @@
--- Imakefile.orig 1992-12-16 00:04:35 UTC
--- Imakefile.orig 2024-09-12 10:01:24 UTC
+++ Imakefile
@@ -2,12 +2,12 @@
LOCAL_LIBRARIES = $(XLIB)
@@ -1,5 +1,5 @@
EXTRA_INCLUDES = -I./fishmaps
-LOCAL_LIBRARIES = $(XLIB)
+LOCAL_LIBRARIES = $(XLIB) -L /usr/local/lib
DEPLIBS = $(DEPXLIB)
SYS_LIBRARIES = -lm
- CDEBUGFLAGS = -g
+XCOMM CDEBUGFLAGS = -g
SRCS = xfish.c medcut.c read.c gifread.c
OBJS = xfish.o medcut.o read.o gifread.o
-ComplexProgramTarget(xfishtank)
+ComplexProgramTargetNoMan(xfishtank)
xfishy.h: makeh FishList
./makeh > xfishy.h
SYS_LIBRARIES = -lImlib2 -lm
MANSRCSUFFIX = 1x

View File

@ -0,0 +1,11 @@
--- makeh.c.orig 2024-09-12 09:44:33 UTC
+++ makeh.c
@@ -16,7 +16,7 @@
printf("};\n\n");
}
-main()
+int main()
{
FILE *fp;
char prefix[BUFSIZ];

View File

@ -0,0 +1,166 @@
--- medcut.c.orig 2013-08-09 11:59:28 UTC
+++ medcut.c
@@ -40,10 +40,8 @@
int NCells;
struct color_rec *Tptr;
-
void
-InitMinMax(boxnum)
-int boxnum;
+InitMinMax(int boxnum)
{
C_boxes[boxnum].min_pix[RED] = 256;
C_boxes[boxnum].max_pix[RED] = 0;
@@ -55,8 +53,7 @@
struct color_rec *
-AddHash(red, green, blue)
-int red, green, blue;
+AddHash(int red, int green, int blue)
{
int lum;
@@ -78,9 +75,7 @@
void
-AddColor(cptr, boxnum)
-struct color_rec *cptr;
-int boxnum;
+AddColor(struct color_rec *cptr, int boxnum)
{
struct color_rec *ptr;
@@ -107,9 +102,7 @@
void
-CountColors(data, colrs)
-unsigned char *data;
-struct colr_data *colrs;
+CountColors(unsigned char *data, struct colr_data *colrs)
{
unsigned char *dptr;
register int i, j;
@@ -142,8 +135,7 @@
int
-FindTarget(tptr)
-int *tptr;
+FindTarget(int *tptr)
{
int range, i, indx;
@@ -175,8 +167,7 @@
void
-SplitBox(boxnum, color_indx)
-int boxnum, color_indx;
+SplitBox(int boxnum,int color_indx)
{
struct color_rec *low, *high;
struct color_rec *data;
@@ -245,8 +236,7 @@
void
-SplitColors(e_cnt)
-int e_cnt;
+SplitColors(int e_cnt)
{
if (ColorCnt < e_cnt) {
int i;
@@ -279,8 +269,7 @@
* Colors passed in 0-65535, internally are 0-255
*/
void
-ConvertColor(rp, gp, bp)
-int *rp, *gp, *bp;
+ConvertColor(int *rp, int *gp, int *bp)
{
struct color_rec *cptr;
register struct color_rec *hash_ptr;
@@ -321,9 +310,7 @@
void
-ConvertData(data, colrs)
-unsigned char *data;
-struct colr_data *colrs;
+ConvertData( unsigned char *data, struct colr_data *colrs)
{
unsigned char *dptr;
register int i, j;
@@ -349,9 +336,7 @@
void
-PrintColormap(e_cnt, colrs)
-int e_cnt;
-struct colr_data *colrs;
+PrintColormap( int e_cnt, struct colr_data *colrs)
{
int i;
@@ -382,11 +367,7 @@
void
-MedianCut(data, w, h, colrs, start_cnt, end_cnt)
-unsigned char *data;
-int *w, *h;
-struct colr_data *colrs;
-int start_cnt, end_cnt;
+MedianCut(unsigned char *data, int *w, int *h, struct colr_data *colrs, int start_cnt, int end_cnt)
{
int i;
@@ -440,10 +421,7 @@
* 0-255.
*/
void
-MedianCount(data, w, h, colrs)
-unsigned char *data;
-int w, h;
-struct colr_data *colrs;
+MedianCount( unsigned char *data, int w, int h, struct colr_data *colrs)
{
unsigned char *dptr;
register int i, j;
@@ -472,8 +450,7 @@
void
-MedianSplit(end_cnt)
-int end_cnt;
+MedianSplit(int end_cnt)
{
C_boxes[0].count = ColorCnt;
SplitColors(end_cnt);
@@ -481,10 +458,7 @@
void
-MedianConvert(data, w, h, colrs)
-unsigned char *data;
-int w, h;
-struct colr_data *colrs;
+MedianConvert(unsigned char *data, int w, int h, struct colr_data *colrs)
{
Width = w;
Height = h;
@@ -493,9 +467,7 @@
void
-MedianMerge(colrs, end_cnt)
-struct colr_data *colrs;
-int end_cnt;
+MedianMerge(struct colr_data *colrs, int end_cnt)
{
int i;

View File

@ -0,0 +1,12 @@
--- medcut.h.orig 2013-08-09 11:59:28 UTC
+++ medcut.h
@@ -4,6 +4,6 @@
};
extern void MedianInit();
-extern void MedianCount();
-extern void MedianSplit();
-extern void ConvertColor();
+extern void MedianCount( unsigned char *data, int w, int h, struct colr_data *colrs);
+extern void MedianSplit(int end_cnt);
+extern void ConvertColor(int *rp, int *gp, int *bp);

View File

@ -1,323 +0,0 @@
--- xfish.c.orig 1992-12-17 21:26:17 UTC
+++ xfish.c
@@ -11,6 +11,8 @@
* Ported to monocrome by Jonathan Greenblatt (jonnyg@rover.umd.edu)
+ * 05/02/1996 Added TrueColor support by TJ Phan (phan@aur.alcatel.com)
+
TODO:
Parameter parsing needs to be redone.
@@ -46,13 +48,24 @@
/* constants are based on rand(3C) returning an integer between 0 and 32767 */
-#if defined(ultrix) || defined(sun) || defined(linux)
+#if defined(ultrix) || defined(sun)
#define RAND_I_1_16 134217728
#define RAND_F_1_8 268435455.875
#define RAND_I_1_4 536870911
#define RAND_I_1_2 1073741823
#define RAND_I_3_4 1610612735
#define RAND_F_MAX 2147483647.0
+#else
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#include <stdlib.h>
+#include <unistd.h>
+
+#define RAND_I_1_16 (RAND_MAX>>4)
+#define RAND_F_1_8 ((float)(RAND_MAX>>3))
+#define RAND_I_1_4 (RAND_MAX>>2)
+#define RAND_I_1_2 (RAND_MAX>>1)
+#define RAND_I_3_4 ((RAND_MAX>>2)*3)
+#define RAND_F_MAX ((float)RAND_MAX)
#else
#define RAND_I_1_16 2048
#define RAND_F_1_8 4096.0
@@ -61,8 +74,8 @@
#define RAND_I_3_4 24575
#define RAND_F_MAX 32767.0
#endif
+#endif
-
extern unsigned char *ReadBitmap();
@@ -850,6 +863,10 @@ putbubble(b, s, c)
* Find the closest color by allocating it, or picking an already allocated
* color
*/
+Visual (*visual_info) = NULL;
+int r_mask, g_mask, b_mask;
+int r_shift=0, g_shift=0, b_shift=0;
+int r_bits=0, g_bits=0, b_bits=0;
void
FindColor(Dpy, colormap, colr)
Display *Dpy;
@@ -862,6 +879,58 @@ FindColor(Dpy, colormap, colr)
XColor def_colrs[256];
int NumCells;
+ if( visual_info == NULL && DefaultDepth(Dpy, DefaultScreen(Dpy)) >= 16 )
+ {
+ visual_info = DefaultVisual(Dpy, DefaultScreen(Dpy));
+ r_mask = visual_info->red_mask;
+ while( !(r_mask & 1) )
+ {
+ r_mask >>= 1;
+ r_shift++;
+ }
+ while( r_mask & 1 )
+ {
+ r_mask >>= 1;
+ r_bits++;
+ }
+
+ g_mask = visual_info->green_mask;
+ while( !(g_mask & 1) )
+ {
+ g_mask >>= 1;
+ g_shift++;
+ }
+ while( g_mask & 1 )
+ {
+ g_mask >>= 1;
+ g_bits++;
+ }
+
+ b_mask = visual_info->blue_mask;
+ while( !(b_mask &1) )
+ {
+ b_mask >>= 1;
+ b_shift++;
+ }
+ while( b_mask & 1 )
+ {
+ b_mask >>= 1;
+ b_bits++;
+ }
+ }
+
+ if( DefaultDepth(Dpy, DefaultScreen(Dpy)) > 8 )
+ {
+ colr->red >>= 16 - r_bits;
+ colr->green >>= 16 - g_bits;
+ colr->blue >>= 16 - b_bits;
+
+ colr->pixel = ((colr->red << r_shift) & visual_info->red_mask) |
+ ((colr->green << g_shift) & visual_info->green_mask) |
+ ((colr->blue << b_shift) & visual_info->blue_mask);
+ return;
+ }
+
if (AllocCnt < climit)
{
match = XAllocColor(Dpy, colormap, colr);
@@ -982,7 +1051,6 @@ init_colormap()
XColor hdef, edef;
struct colr_data *cdp;
struct colr_data colrs[256];
- extern char *malloc();
colormap = XDefaultColormap(Dpy, screen);
@@ -1151,6 +1219,7 @@ MakeImage(data, width, height)
fprintf(stderr, "Don't know how to format image for display of depth %d\n", depth);
exit(1);
}
+
if (BitmapBitOrder(Dpy) == LSBFirst)
{
shiftstart = 0;
@@ -1194,7 +1263,8 @@ MakeImage(data, width, height)
}
}
}
- bytesperline = (width + linepad) * depth / 8;
+
+ bytesperline = (width * depth / 8 + linepad);
newimage = XCreateImage(Dpy, DefaultVisual(Dpy, screen), depth,
ZPixmap, 0, (char *)bit_data,
(width + linepad), height, 8, bytesperline);
@@ -1218,7 +1288,6 @@ init_pixmap()
unsigned char *data;
register int i, j, k;
int cnt, wcnt;
- extern char *malloc();
cnt = 1;
cnt += Pcnt;
@@ -1341,9 +1410,14 @@ init_pixmap()
free((char *)data);
}
+ if( DisplayPlanes(Dpy, screen) < 8 )
+ {
+
j = rwidth[k] * rheight[k];
x1A = (caddrt) malloc(rwidth[k] * rheight[k]);
p = (caddrt) xfishRasterA[k];
+
+
q = x1A;
for (i = 0; i < j; i++)
{
@@ -1389,8 +1463,69 @@ init_pixmap()
xfishB[k][2] = MakeImage(x1B, rwidth[k], rheight[k]);
xfishB[k][1] = MakeImage(x2B, rwidth[k], rheight[k]);
+ free((char *)x1A);
+ free((char *)x2A);
+ free((char *)x1B);
+ free((char *)x2B);
+
+ }
+ else
+ {
i = DisplayPlanes(Dpy, screen);
+ xfishA[k][2] = XGetImage(Dpy, DefaultRootWindow(Dpy), 0, 0, rwidth[k], rheight[k], 0, ZPixmap);
+
+ p = (caddrt) xfishRasterA[k];
+
+ for (j = 0; j < rheight[k]; j++)
+ {
+ for( i = 0; i < rwidth[k]; i++ )
+ {
+ XPutPixel(xfishA[k][2], i, j, cmap[cnt + (int)(*p)]);
+ p++;
+ }
+ }
+
+ xfishB[k][2] = XGetImage(Dpy, DefaultRootWindow(Dpy), 0, 0, rwidth[k], rheight[k], 0, ZPixmap);
+
+ p = (caddrt) xfishRasterB[k];
+
+ for (j = 0; j < rheight[k]; j++)
+ {
+ for( i = 0; i < rwidth[k]; i++ )
+ {
+ XPutPixel(xfishB[k][2], i, j, cmap[cnt + (int)(*p)]);
+ p++;
+ }
+ }
+
+ xfishA[k][1] = XGetImage(Dpy, DefaultRootWindow(Dpy), 0, 0, rwidth[k], rheight[k], 0, ZPixmap);
+
+ for (j = 0; j < rheight[k]; j++)
+ {
+ for( i = 0; i < rwidth[k]; i++ )
+ {
+ XPutPixel(xfishA[k][1], i, j,
+ XGetPixel(xfishA[k][2], rwidth[k] - i -1, j));
+ }
+ }
+
+ xfishB[k][1] = XGetImage(Dpy, DefaultRootWindow(Dpy), 0, 0, rwidth[k], rheight[k], 0, ZPixmap);
+
+ for (j = 0; j < rheight[k]; j++)
+ {
+ for( i = 0; i < rwidth[k]; i++ )
+ {
+ XPutPixel(xfishB[k][1], i, j,
+ XGetPixel(xfishB[k][2], rwidth[k] - i - 1, j));
+ }
+ }
+
+ }
+
+
+ i = DisplayPlanes(Dpy, screen);
+
pfishA[k][1] = XCreatePixmap(Dpy, wid,
rwidth[k], rheight[k], i);
pfishA[k][2] = XCreatePixmap(Dpy, wid,
@@ -1400,11 +1535,6 @@ init_pixmap()
pfishB[k][2] = XCreatePixmap(Dpy, wid,
rwidth[k], rheight[k], i);
- free((char *)x1A);
- free((char *)x2A);
- free((char *)x1B);
- free((char *)x2B);
-
if (pfishA[k][1])
{
XPutImage(Dpy, pfishA[k][1], gc, xfishA[k][1], 0, 0,
@@ -1465,34 +1595,6 @@ Initialize signal so that SIGUSR1 causes secure mode t
void
init_signals()
{
- int ret;
-#ifdef linux
- signal(SIGUSR1, toggle_secure);
-#else
-#if defined(MOTOROLA) || defined(SCO)
- sigset(SIGUSR1, toggle_secure);
-#else
- struct sigvec vec;
-
- vec.sv_handler = toggle_secure;
- vec.sv_mask = 0;
- vec.sv_onstack = 0;
-
-#ifndef hpux
- ret = sigvec(SIGUSR1, &vec, &vec);
- if (ret != 0)
- {
- fprintf(stderr, "sigvec call failed\n");
- }
- else
- {
- fprintf(stderr, "sigvec call OK\n");
- }
-#else
- sigvector(SIGUSR1, &vec, &vec);
-#endif
-#endif /* MOTOROLA */
-#endif /* LINUX */
}
@@ -1505,7 +1607,6 @@ initialize()
XWindowAttributes winfo;
XSetWindowAttributes attr;
XGCValues vals;
- extern char *malloc();
XSizeHints xsh;
XImage *pimage;
int i, size, cnt;
@@ -1613,13 +1714,12 @@ if ((!DoClipping)||(picname[0] != '\0'))
xsh.height = height;
XSetNormalHints(Dpy, wid, &xsh);
+ XMapWindow(Dpy, wid);
if (picname[0] != '\0')
{
XPutImage(Dpy, PicMap, gc, pimage, 0, 0, 0, 0, Pwidth, Pheight);
XSetWindowBackgroundPixmap(Dpy, wid, PicMap);
}
-
- XMapWindow(Dpy, wid);
}
binfo = (bubble *) malloc(blimit * sizeof(bubble));
@@ -1965,9 +2065,15 @@ void
high_res_sleep(seconds)
double seconds;
{
+#ifndef __FreeBSD__
int fds = 0;
+#endif
struct timeval timeout;
-
+#ifdef __FreeBSD__
+ fd_set fds;
+ FD_ZERO(&fds);
+#endif
+
timeout.tv_sec = seconds;
timeout.tv_usec = (seconds - timeout.tv_sec) * 1000000.0;
select(0, &fds, &fds, &fds, &timeout);

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<screensaver name="xfishtank" _label="XFishtank">
<video href="https://www.youtube.com/watch?v=6Q8ZTxsopYA"/>
<file id="bgfile" _label="Background image" arg="-p %"/>
<string id="bgcolor" _arg="-c %"
_label="Background color (eg. red, MediumAquamarine, #ff0000)"/>
<number id="nbubbles" _label="Number of bubbles" arg="-b %"
high="100" low="0" step="1" default="32"/>
<number _id="nfishes" _label="Number of fishes" arg="-f %"
high="100" low="0" step="1" default="10"/>
<xscreensaver-updater />
<_description>
XFish Tank.
Eric Bina (Original author), Dave Black (Linux port),
TJ Phan (TrueColor Support), Vincent Renardias (man page, Debian packaging)
</_description>
</screensaver>

6
x11/xfishtank/pkg-plist Normal file
View File

@ -0,0 +1,6 @@
bin/xfishtank
bin/xscreensaver-hacks/xfishtank
share/man/man1/xfishtank.1.gz
share/xscreensaver/config/xfishtank.xml
@dir share/xscreensaver/config
@dir bin/xscreensaver-hacks