git: 6dc548efbea2 - main - x11/habak: New port: Background changing app

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Sat, 06 May 2023 09:01:46 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6dc548efbea2a67c4274f4efd5e6c16f71572f40

commit 6dc548efbea2a67c4274f4efd5e6c16f71572f40
Author:     JesĂşs Daniel Colmenares Oviedo <DtxdF@disroot.org>
AuthorDate: 2023-05-01 12:18:02 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-05-06 08:58:38 +0000

    x11/habak: New port: Background changing app
    
    habak is a background changing app.
    
    habak uses layered model. Lowermost layer is just black screen. You
    can put other objects on it and these objects are called habaks.
    There are three kinds of habaks: graphic files (images), texts and
    "internal objects". Final background image consists of one or more
    habaks positioned on the black screen. The order of habaks in the
    command line is also the order of displaying them on screen. So
    last habak would be drawn on the top of previous.
    
    WWW: https://sourceforge.net/projects/fvwm-crystal/
    
    PR:             266120
---
 x11/Makefile                       |  1 +
 x11/habak/Makefile                 | 23 +++++++++++++++++
 x11/habak/distinfo                 |  3 +++
 x11/habak/files/patch-Makefile     |  8 ++++++
 x11/habak/files/patch-src_Makefile | 32 +++++++++++++++++++++++
 x11/habak/files/patch-src_habak.c  | 47 +++++++++++++++++++++++++++++++++
 x11/habak/files/patch-src_random.c | 53 ++++++++++++++++++++++++++++++++++++++
 x11/habak/pkg-descr                |  9 +++++++
 8 files changed, 176 insertions(+)

diff --git a/x11/Makefile b/x11/Makefile
index daaa5d9c6d31..4d3da6fe76d0 100644
--- a/x11/Makefile
+++ b/x11/Makefile
@@ -112,6 +112,7 @@
     SUBDIR += gtkterm2
     SUBDIR += guake
     SUBDIR += gxkb
+    SUBDIR += habak
     SUBDIR += hamclock
     SUBDIR += hhpc
     SUBDIR += hs-xmobar
diff --git a/x11/habak/Makefile b/x11/habak/Makefile
new file mode 100644
index 000000000000..80b5ca447b47
--- /dev/null
+++ b/x11/habak/Makefile
@@ -0,0 +1,23 @@
+PORTNAME=	habak
+DISTVERSION=	0.2.5
+CATEGORIES=	x11
+MASTER_SITES=	SF/fvwm-crystal/habak/${DISTVERSION}
+
+MAINTAINER=	DtxdF@disroot.org
+COMMENT=	Background changing app
+WWW=		https://sourceforge.net/projects/fvwm-crystal/
+
+LICENSE=	GPLv2
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+LIB_DEPENDS+=	libImlib2.so:graphics/imlib2 \
+		libX11.so:x11/libX11
+
+USES=		localbase:ldflags
+
+PLIST_FILES=	bin/${PORTNAME}
+
+do-install:
+	(cd ${WRKSRC}/src && ${INSTALL_PROGRAM} ${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME})
+
+.include <bsd.port.mk>
diff --git a/x11/habak/distinfo b/x11/habak/distinfo
new file mode 100644
index 000000000000..9d2b705f547f
--- /dev/null
+++ b/x11/habak/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1661854392
+SHA256 (habak-0.2.5.tar.gz) = a996ddca6c99bbeb343c2ad584ccd4f51723dece90e828abee99398cd402f509
+SIZE (habak-0.2.5.tar.gz) = 28747
diff --git a/x11/habak/files/patch-Makefile b/x11/habak/files/patch-Makefile
new file mode 100644
index 000000000000..9b8970b4bfd2
--- /dev/null
+++ b/x11/habak/files/patch-Makefile
@@ -0,0 +1,8 @@
+--- Makefile.orig	2022-08-30 10:17:30 UTC
++++ Makefile
+@@ -3,5 +3,3 @@ all:
+ 
+ clean:
+ 	make -C src clean
+-	rm habak
+-
diff --git a/x11/habak/files/patch-src_Makefile b/x11/habak/files/patch-src_Makefile
new file mode 100644
index 000000000000..d669b462c5f4
--- /dev/null
+++ b/x11/habak/files/patch-src_Makefile
@@ -0,0 +1,32 @@
+--- src/Makefile.orig	2022-08-30 10:14:57 UTC
++++ src/Makefile
+@@ -1,23 +1,22 @@
+ #CFLAGS = -I/usr/X11R6/include -Wall -g -ggdb
+ #LDFLAGS = -L/usr/X11R6/lib -lImlib2 -lm -g -ggdb
+ 
+-CFLAGS += -I/usr/X11R6/include -Wall
+-LDFLAGS += -L/usr/X11R6/lib -lImlib2 -lm
++CFLAGS+=	-Wall
++LDFLAGS+=	-lX11 -lImlib2 -lm
+ 
+ all:	habak
+-	ln -f habak ../habak
+ 
+ habak:	xcore.o random.o habak.o
+-	gcc $(LDFLAGS) -o habak xcore.o random.o habak.o
++	${CC} $(LDFLAGS) -o habak xcore.o random.o habak.o
+ 
+ habak.o: habak.c types.h defaults.h proto.h
+-	gcc $(CFLAGS) -c habak.c -o habak.o
++	${CC} $(CFLAGS) -c habak.c -o habak.o
+ 
+ random.o: random.c proto.h
+-	gcc $(CFLAGS) -c random.c -o random.o
++	${CC} $(CFLAGS) -c random.c -o random.o
+ 
+ xcore.o: xcore.c
+-	gcc $(CFLAGS) -c xcore.c -o xcore.o
++	${CC} $(CFLAGS) -c xcore.c -o xcore.o
+ 
+ clean:
+ 	rm habak *.o
diff --git a/x11/habak/files/patch-src_habak.c b/x11/habak/files/patch-src_habak.c
new file mode 100644
index 000000000000..ca83b018d51d
--- /dev/null
+++ b/x11/habak/files/patch-src_habak.c
@@ -0,0 +1,47 @@
+--- src/habak.c.orig	2022-08-30 10:28:37 UTC
++++ src/habak.c
+@@ -22,7 +22,7 @@ struct stat file_info;
+ double xco,yco;
+ DATA32 *raw_data;
+ 
+-int i, multy;
++int multy;
+ Imlib_Image workspace;
+ habak_t template_habak;
+ 
+@@ -197,7 +197,7 @@ template_habak.text=DEFAULT_TEXT;
+ 
+ if (argc==1) {print_help(0);}
+ 
+-for (i=1;i<argc;i++) {
++for (int i=1;i<argc;i++) {
+ 	if (!strcmp(argv[i],"-mC")) {
+ 		d("parse center");
+ 		template_habak.center=MOD_CENTER;
+@@ -515,7 +515,7 @@ switch (current_list_item->data.type) {
+ 	imlib_context_set_image(current_list_item->data.image);
+ 	imlib_image_set_has_alpha(1);
+ 	imlib_context_set_color(current_list_item->data.red,current_list_item->data.green,current_list_item->data.blue,current_list_item->data.alpha);
+-	for (i=0;i<scr->height;i+=2) {
++	for (int i=0;i<scr->height;i+=2) {
+ 		imlib_image_draw_line(0,i,current_list_item->data.width,i,0);
+ 	}
+ 	/* OK, mamy gotowy obraz. Ponieważ jest to teraz tak naprawdę _obraz_, to
+@@ -533,7 +533,7 @@ switch (current_list_item->data.type) {
+ 	imlib_context_set_image(current_list_item->data.image);
+ 	imlib_image_set_has_alpha(1);
+ 	imlib_context_set_color(current_list_item->data.red,current_list_item->data.green,current_list_item->data.blue,current_list_item->data.alpha);
+-	for (i=1;i<scr->height;i+=2) {imlib_image_draw_line(0,i,current_list_item->data.width,i,0);}
++	for (int i=1;i<scr->height;i+=2) {imlib_image_draw_line(0,i,current_list_item->data.width,i,0);}
+ 	/* OK, mamy gotowy obraz. Ponieważ jest to teraz tak naprawdę _obraz_, to
+ 	 * można zmienić jego typ na "IMAGE_HABAK"
+ 	 */
+@@ -561,7 +561,7 @@ switch (current_list_item->data.type) {	
+ 	imlib_context_set_font(current_list_item->data.font);
+ 	multxt=current_list_item->data.text;
+ 	multy=current_list_item->data.y;
+-	while (multxt10=strchr(multxt,10)) {
++	while ((multxt10=strchr(multxt,10))) {
+ 		*multxt10=0;
+ 		imlib_text_draw(current_list_item->data.x,multy,multxt);
+ 		*multxt10=10;
diff --git a/x11/habak/files/patch-src_random.c b/x11/habak/files/patch-src_random.c
new file mode 100644
index 000000000000..bfb07973dd4b
--- /dev/null
+++ b/x11/habak/files/patch-src_random.c
@@ -0,0 +1,53 @@
+--- src/random.c.orig	2004-12-09 17:01:43 UTC
++++ src/random.c
+@@ -13,7 +13,7 @@ int syserr;
+ 
+ #define ALLOC_STEP 1000
+ regex_t regexp;
+-int size_files=0, used_files=0, i=0;
++int size_files=0, used_files=0;
+ char **files, *wyjscie;
+ regmatch_t matchpos;
+ 
+@@ -70,9 +70,9 @@ return;
+ 
+ char *randomly_select_font(const char *wejscie){
+ 
+-files=NULL;wyjscie=NULL;size_files=0;used_files=0;i=0;
++files=NULL;wyjscie=NULL;size_files=0;used_files=0;;
+ 
+-regcomp(&regexp,"^.*\\.ttf$",REG_ICASE||REG_NOSUB);
++regcomp(&regexp,"^.*\\.ttf$",REG_ICASE|REG_NOSUB);
+ 
+ add_file(wejscie);
+ 
+@@ -80,7 +80,7 @@ if (used_files==0) {
+ 	return NULL;
+ }
+ 
+-i=rand()%used_files;
++int i=rand()%used_files;
+ wyjscie=malloc(strlen(files[i])+1);
+ strcpy(wyjscie,files[i]);
+ 
+@@ -92,9 +92,9 @@ return wyjscie;
+ 
+ char *randomly_select_image(const char *wejscie){
+ 
+-files=NULL;wyjscie=NULL;size_files=0;used_files=0;i=0;
++files=NULL;wyjscie=NULL;size_files=0;used_files=0;;
+ 
+-regcomp(&regexp,"^.*\\.(bmp|jpg|jpeg|png|tiff|tif|tga|gif|pcx|xpm|pnm|ppm|xbm)$",REG_ICASE||REG_NOSUB);
++regcomp(&regexp,"^.*\\.(bmp|jpg|jpeg|png|tiff|tif|tga|gif|pcx|xpm|pnm|ppm|xbm)$",REG_ICASE|REG_NOSUB);
+ 
+ add_file(wejscie);
+ 
+@@ -102,7 +102,7 @@ if (used_files==0) {
+ 	return NULL;
+ }
+ 
+-i=rand()%used_files;
++int i=rand()%used_files;
+ wyjscie=malloc(strlen(files[i])+1);
+ strcpy(wyjscie,files[i]);
+ 
diff --git a/x11/habak/pkg-descr b/x11/habak/pkg-descr
new file mode 100644
index 000000000000..2b520a63ca3b
--- /dev/null
+++ b/x11/habak/pkg-descr
@@ -0,0 +1,9 @@
+habak is a background changing app.
+
+habak uses layered model. Lowermost layer is just black screen. You
+can put other objects on it and these objects are called habaks.
+There are three kinds of habaks: graphic files (images), texts and
+"internal objects". Final background image consists of one or more
+habaks positioned on the black screen. The order of habaks in the
+command line is also the order of displaying them on screen. So
+last habak would be drawn on the top of previous.