Control: tags 1097624 + patch

Dear maintainer,

I've prepared an NMU for pngphoon (versioned as 1.4-0.1) and
uploaded it to DELAYED/7. Please feel free to tell me if I
should cancel it.

NOTE: The compilation failure (FTBFS) is fixed in the version I am shipping
tested with gcc 15.

Regards.
diffstat for pngphoon-1.3 pngphoon-1.4

 Makefile                                                        |   22 -
 contrib/Makefile.mxe                                            |   13 
 contrib/pngphoon.1                                              |   64 +++
 contrib/pngphoon.sgml                                           |  213 ++++++++++
 debian/changelog                                                |    9 
 debian/patches/Fix-FTBFS-using-GCC-15.patch                     |   58 ++
 debian/patches/Fix-incorrect-pointer-and-change-to-time_t.patch |   24 -
 debian/patches/series                                           |    1 
 main.c                                                          |    2 
 moon.c                                                          |   31 -
 10 files changed, 407 insertions(+), 30 deletions(-)

diff -Nru pngphoon-1.3/contrib/Makefile.mxe pngphoon-1.4/contrib/Makefile.mxe
--- pngphoon-1.3/contrib/Makefile.mxe	1969-12-31 21:00:00.000000000 -0300
+++ pngphoon-1.4/contrib/Makefile.mxe	2025-05-25 19:58:32.000000000 -0300
@@ -0,0 +1,13 @@
+
+# this Makefile is intended to be used by "make -f contrib/Makefile.mxe"
+
+CROSS = /opt/mxe/usr/bin/i686-w64-mingw32.static-
+CC = $(CROSS)gcc
+STRIP = $(CROSS)strip
+EXT = .exe
+
+include Makefile
+
+# overwrite CFLAGS
+CFLAGS = -Os
+
diff -Nru pngphoon-1.3/contrib/pngphoon.1 pngphoon-1.4/contrib/pngphoon.1
--- pngphoon-1.3/contrib/pngphoon.1	1969-12-31 21:00:00.000000000 -0300
+++ pngphoon-1.4/contrib/pngphoon.1	2025-05-25 19:58:32.000000000 -0300
@@ -0,0 +1,64 @@
+.TH "PNGPHOON" "1" 
+.SH "NAME" 
+pngphoon \(em Creates a png file with the current phase of the moon 
+.SH "SYNOPSIS" 
+.PP 
+\fBpngphoon\fR [\fB-w \fIwidth\fR\fP]  [\fB-h \fIheight\fR\fP]  [\fB-f \fIfilename\fR\fP]  [\fB-x \fImoons_in_x\fR\fP]  [\fB-y \fImoons_in_y\fR\fP]  [\fB-s \fIdensity\fR\fP]  [\fB-b\fP]  [\fB-q\fP]  
+.SH "DESCRIPTION" 
+.PP 
+This manual page documents briefly the 
+\fBpngphoon\fR command. 
+.PP 
+This manual page was written for the \fBDebian\fP distribution 
+because the original program does not have a manual page. 
+.PP 
+\fBpngphoon\fR is a program that creates a PNG image 
+of the current phase of the moon. It is a successor to xphoon but does not 
+write to the root window, but to a file.  You can use it with window 
+managers that accept commands for their background image settings.   
+It is pronounced "pingphoon" (like "typhoon").   
+.SH "OPTIONS" 
+.PP 
+This program takes the following options. 
+.IP "\fB-h\fP         " 10 
+Mandatory. Gives the image height. If the height is smaller 
+than 760px, then only the center part will be created. 
+.IP "\fB-w\fP         " 10 
+Mandatory. Gives the image width. The image must be at 
+least 760px wide to be able to contain the moon. If the image 
+is smaller only the stars will be plotted. 
+.IP "\fB-f\fP         " 10 
+Mandatory. File name the PNG image shall be written to, 
+for output to stdout use ``\fI-\fP'' (hyphen) instead of 
+a filename. 
+.IP "\fB-x\fP         " 10 
+Number of moons in x axis (for multihead configurations) 
+.IP "\fB-y\fP         " 10 
+Number of moons in y axis (for multihead configurations) 
+.IP "\fB-s\fP         " 10 
+Star density 
+.IP "\fB-b\fP         " 10 
+Black (no earthlight) 
+.IP "\fB-S\fP         " 10 
+Southern hemisphere (rotate image 180 degrees) 
+.IP "\fB-q\fP         " 10 
+Quiet (disable warnings) 
+.SH "AUTHOR" 
+.PP 
+The software was written by Sven Oliver ("SvOlli") Moll, based 
+upon xphoon.  The homepage of the software is available at 
+https://svolli.de/software/pngphoon/ . 
+ 
+.PP 
+This manual page was originally written by Meike Reichle 
+for the \fBDebian\fP system. After she stopped maintaining it, it 
+was moved into the original source code and is now maintained 
+by Sven Oliver Moll ([email protected]). Permission is granted to copy, 
+distribute and/or modify this document under the terms of the 
+GNU General Public License, Version 2. 
+ 
+.PP 
+On Debian systems, the complete text of the GNU General Public 
+License can be found in /usr/share/common-licenses/GPL-2. 
+ 
+.\" created by instant / docbook-to-man 
diff -Nru pngphoon-1.3/contrib/pngphoon.sgml pngphoon-1.4/contrib/pngphoon.sgml
--- pngphoon-1.3/contrib/pngphoon.sgml	1969-12-31 21:00:00.000000000 -0300
+++ pngphoon-1.4/contrib/pngphoon.sgml	2025-05-25 19:58:32.000000000 -0300
@@ -0,0 +1,213 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+<!-- Process this file with docbook-to-man to generate an nroff manual
+     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view
+     the manual page with: `docbook-to-man manpage.sgml | nroff -man |
+     less'.  A typical entry in a Makefile or Makefile.am is:
+
+manpage.1: manpage.sgml
+	docbook-to-man $< > $@
+
+    
+	The docbook-to-man binary is found in the docbook-to-man package.
+	Please remember that if you create the nroff version in one of the
+	debian/rules file targets (such as build), you will need to include
+	docbook-to-man in your Build-Depends control field.
+
+  -->
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!-- original creator of this manpage was Meike Reichle, thanks -->
+  <!ENTITY dhfirstname "<firstname>Sven Oliver</firstname>">
+  <!ENTITY dhsurname   "<surname>Moll</surname>">
+  <!-- Please adjust the date whenever revising the manpage. -->
+  <!ENTITY dhdate      "<date>April 24, 2025</date>">
+  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+       allowed: see man(7), man(1). -->
+  <!ENTITY dhsection   "<manvolnum>1</manvolnum>">
+  <!ENTITY dhemail     "<email>[email protected]</email>">
+  <!ENTITY dhusername  "Sven Oliver Moll">
+  <!ENTITY dhucpackage "<refentrytitle>PNGPHOON</refentrytitle>">
+  <!ENTITY dhpackage   "pngphoon">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2003</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>Creates a png file with the current phase of the moon</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+
+      <arg><option>-w <replaceable>width</replaceable></option></arg>
+      <arg><option>-h <replaceable>height</replaceable></option></arg>
+      <arg><option>-f <replaceable>filename</replaceable></option></arg>
+
+	<arg><option>-x <replaceable>moons_in_x</replaceable></option></arg>
+	<arg><option>-y <replaceable>moons_in_y</replaceable></option></arg>
+	<arg><option>-s <replaceable>density</replaceable></option></arg>
+	<arg><option>-b</option></arg>
+	<arg><option>-q</option></arg>
+      
+
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> command.</para>
+
+    <para>This manual page was written for the &debian; distribution
+      because the original program does not have a manual page.</para>
+
+    <para><command>&dhpackage;</command> is a program that creates a PNG image
+    of the current phase of the moon. It is a successor to xphoon but does not
+    write to the root window, but to a file.  You can use it with window
+    managers that accept commands for their background image settings.  
+    It is pronounced "pingphoon" (like "typhoon").  </para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <para>This program takes the following options.</para>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-h</option>
+        </term>
+        <listitem>
+          <para>Mandatory. Gives the image height. If the height is smaller
+            than 760px, then only the center part will be created.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-w</option>
+        </term>
+        <listitem>
+          <para>Mandatory. Gives the image width. The image must be at
+            least 760px wide to be able to contain the moon. If the image
+            is smaller only the stars will be plotted.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-f</option>
+        </term>
+        <listitem>
+          <para>Mandatory. File name the PNG image shall be written to,
+            for output to stdout use <quote>-</quote> (hyphen) instead of
+            a filename.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-x</option>
+        </term>
+	<listitem>
+	  <para>Number of moons in x axis (for multihead configurations)</para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-y</option>
+        </term>
+	<listitem>
+	  <para>Number of moons in y axis (for multihead configurations)</para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-s</option>
+        </term>
+	<listitem>
+	  <para>Star density</para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-b</option>
+        </term>
+	<listitem>
+	  <para>Black (no earthlight)</para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-S</option>
+        </term>
+	<listitem>
+	  <para>Southern hemisphere (rotate image 180 degrees)</para>
+	</listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-q</option>
+        </term>
+	<listitem>
+	  <para>Quiet (disable warnings)</para>
+	</listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>
+      The software was written by Sven Oliver ("SvOlli") Moll, based
+      upon xphoon.  The homepage of the software is available at
+      https://svolli.de/software/pngphoon/ .
+    </para>
+    <para>This manual page was originally written by Meike Reichle
+      for the &debian; system. After she stopped maintaining it, it
+      was moved into the original source code and is now maintained
+      by &dhusername; (&dhemail;). Permission is granted to copy,
+      distribute and/or modify this document under the terms of the
+      &gnu; General Public License, Version 2.
+    </para>
+    <para>
+      On Debian systems, the complete text of the GNU General Public
+      License can be found in /usr/share/common-licenses/GPL-2.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->
+
+
diff -Nru pngphoon-1.3/debian/changelog pngphoon-1.4/debian/changelog
--- pngphoon-1.3/debian/changelog	2024-11-18 01:55:38.000000000 -0300
+++ pngphoon-1.4/debian/changelog	2025-07-02 00:22:12.000000000 -0300
@@ -1,3 +1,12 @@
+pngphoon (1.4-0.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * New upstream version 1.4.
+  * d/patches:
+    - Fix-FTBFS-using-GCC-15.patch: Fix FTBFS with GCC-15. (Closes: 1097624)
+
+ -- Leandro Cunha <[email protected]>  Wed, 02 Jul 2025 00:22:12 -0300
+
 pngphoon (1.3-3.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru pngphoon-1.3/debian/patches/Fix-FTBFS-using-GCC-15.patch pngphoon-1.4/debian/patches/Fix-FTBFS-using-GCC-15.patch
--- pngphoon-1.3/debian/patches/Fix-FTBFS-using-GCC-15.patch	1969-12-31 21:00:00.000000000 -0300
+++ pngphoon-1.4/debian/patches/Fix-FTBFS-using-GCC-15.patch	2025-07-02 00:22:12.000000000 -0300
@@ -0,0 +1,58 @@
+Description: Align dlocaltime() declaration and remove redundant localtime()
+ Add #include <time.h> to tws.h to define time_t.
+ Update dlocaltime() prototype in tws.h to match implementation (const time_t *)
+ Remove conflicting declaration of localtime() in tws.c
+Author: Leandro Cunha <[email protected]>
+Bug-Debian: https://bugs.debian.org/1097624
+
+From: Leandro Cunha <[email protected]>
+Date: Wed, 2 Jul 2025 00:17:30 -0300
+Subject: Fix FTBFS using GCC 15
+
+Fix FTBFS with GCC 15: align dlocaltime() declaration and remove redundant localtime()
+
+- Add #include <time.h> to tws.h to define time_t
+- Update dlocaltime() prototype in tws.h to match implementation (const time_t *)
+- Remove conflicting declaration of localtime() in tws.c
+
+This fixes build errors with GCC 15 due to conflicting types and unknown time_t.
+---
+ tws.c | 2 --
+ tws.h | 4 ++--
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/tws.c b/tws.c
+index 4e601d5..cdf44c5 100644
+--- a/tws.c
++++ b/tws.c
+@@ -37,8 +37,6 @@ extern long timezone;
+ #include <sys/timeb.h>
+ #endif /*SYS5*/
+ 
+-struct tm* localtime();
+-
+ struct tws *dtwstime()
+ {
+    time_t clock = 0;
+diff --git a/tws.h b/tws.h
+index 2d69b2f..7f2a388 100644
+--- a/tws.h
++++ b/tws.h
+@@ -2,7 +2,7 @@
+ 
+ 
+ /* Definition of the tws data structure. */
+-
++#include <time.h>
+ #ifndef _TWS_H_
+ #define _TWS_H_ _TWS_H_
+ 
+@@ -33,7 +33,7 @@ struct tws
+ 
+ /* Declarations of routines. */
+ 
+-struct tws *dlocaltime( );
++struct tws *dlocaltime( const time_t * );
+         /* dlocaltime( &clock ) turns a time(3) clock value into a tws */
+ 
+ struct tws *dtwstime( );
diff -Nru pngphoon-1.3/debian/patches/Fix-incorrect-pointer-and-change-to-time_t.patch pngphoon-1.4/debian/patches/Fix-incorrect-pointer-and-change-to-time_t.patch
--- pngphoon-1.3/debian/patches/Fix-incorrect-pointer-and-change-to-time_t.patch	2024-11-18 01:55:38.000000000 -0300
+++ pngphoon-1.4/debian/patches/Fix-incorrect-pointer-and-change-to-time_t.patch	2025-07-02 00:21:12.000000000 -0300
@@ -1,16 +1,18 @@
-Description: Fix incorrect pointer type and change to time_t
- Altered pointer comparison in dlocaltime function to properly check for NULL.
- .
- Replaced the incorrect check `clock == (long*) 0` with `!clock` to ensure the
- pointer validation is done safely.
- .
- Changed the return value to `NULL` instead of an invalid cast to
- `(struct tws*) 0` to follow proper C conventions and improve clarity.
- .
- Ensures better readability and prevents potential pointer-related type errors.
+From: Leandro Cunha <[email protected]>
+Date: Mon, 30 Jun 2025 14:39:11 -0300
+Subject: Fix incorrect pointer type and change to time_t
+
 Bug-Debian: https://bugs.debian.org/1065972
-Author: Leandro Cunha <[email protected]>
 
+Altered pointer comparison in dlocaltime function to properly check for NULL.
+
+Replaced the incorrect check `clock == (long*) 0` with `!clock` to ensure the
+pointer validation is done safely.
+
+Changed the return value to `NULL` instead of an invalid cast to
+`(struct tws*) 0` to follow proper C conventions and improve clarity.
+
+Ensures better readability and prevents potential pointer-related type errors.
 ---
  tws.c | 13 +++++++------
  1 file changed, 7 insertions(+), 6 deletions(-)
diff -Nru pngphoon-1.3/debian/patches/series pngphoon-1.4/debian/patches/series
--- pngphoon-1.3/debian/patches/series	2024-11-18 01:55:38.000000000 -0300
+++ pngphoon-1.4/debian/patches/series	2025-07-02 00:21:12.000000000 -0300
@@ -1 +1,2 @@
 Fix-incorrect-pointer-and-change-to-time_t.patch
+Fix-FTBFS-using-GCC-15.patch
diff -Nru pngphoon-1.3/main.c pngphoon-1.4/main.c
--- pngphoon-1.3/main.c	2021-12-18 18:33:04.000000000 -0300
+++ pngphoon-1.4/main.c	2025-05-25 19:58:32.000000000 -0300
@@ -141,7 +141,7 @@
          disablewarn();
          break;
       default:
-         fail("unknown option: '%c'\n", c);
+         fail( "unknown option: '%c'\n", optopt );
       }
    }
 
diff -Nru pngphoon-1.3/Makefile pngphoon-1.4/Makefile
--- pngphoon-1.3/Makefile	2021-12-15 08:04:07.000000000 -0300
+++ pngphoon-1.4/Makefile	2025-05-25 19:58:32.000000000 -0300
@@ -1,16 +1,30 @@
 
-CC=gcc
+CC ?= gcc
+STRIP ?= strip
+UPX ?= upx
 CFLAGS += -Os -Wall -Wextra -pedantic -DSYS5=1
 LDFLAGS += -lpng -lz -lm
+EXT ?=
 
-all: pngphoon
+all: pngphoon$(EXT)
 
-pngphoon: image.o pngwrite.o moon.o main.o phase.o tws.o stars.o fail.o
+.PHONY: man pack clean
+
+pngphoon$(EXT): image.o pngwrite.o moon.o main.o phase.o tws.o stars.o fail.o
 	$(CC) -o $@ $^ $(LDFLAGS)
 
 %.o: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
 
+contrib/pngphoon.1: contrib/pngphoon.sgml
+	docbook-to-man $< > $@
+
+man: contrib/pngphoon.1
+
+pack: pngphoon$(EXT)
+	$(STRIP) -R .note -R .comment $<
+	$(UPX) --ultra-brute $<
+
 clean:
-	rm -f *.o pngphoon
+	rm -f *.o pngphoon$(EXT)
 
diff -Nru pngphoon-1.3/moon.c pngphoon-1.4/moon.c
--- pngphoon-1.3/moon.c	2021-12-15 08:15:42.000000000 -0300
+++ pngphoon-1.4/moon.c	2025-05-25 19:58:32.000000000 -0300
@@ -55,7 +55,7 @@
 }
 
 
-void mooncopy(image_t *image, moon_t *moondata, int cx, int cy, int blackflag)
+void mooncopy( image_t *image, moon_t *moondata, int cx, int cy, int blackflag )
 {
    double jd = 0.0;
    double angphase = 0.0;
@@ -104,10 +104,10 @@
    ratio = (1.0 - cphase) / cphase;        /* ratio varies from 9.0 to 0.111 */
    shadeindex = (int) ( ratio / 9.0 * 15.9999 );
 
-   for ( i = 0; i < 2 * r; ++i )
+   for( i = 0; i < 2 * r; ++i )
    {
       y = moondata->height/2 - r + i;
-      if ( y < 0 || y >= (int)moondata->height )
+      if( y < 0 || y >= (int)moondata->height )
       {
          continue;
       }
@@ -115,7 +115,19 @@
       fxright = r * sqrt( 1.0 - ( fy * fy ) / ( r * r ) );
       fxleft = - fxright;
 
-      if ( angphase >= 0.0 && angphase < M_PI )
+      xleft = fxleft + moondata->width/2 + 0.5;
+      xright = fxright + moondata->width/2 + 0.5;
+
+      bytexleft = xleft / 8;
+      bytexright = (xright+7) / 8;
+
+      /* copy moon for later modification */
+      for( x = bytexleft; x < bytexright; ++x )
+      {
+         image->bitmap[x + imageoff] = moondata->bitmap[x + moonoff];
+      }
+
+      if( angphase >= 0.0 && angphase < M_PI )
       {
          fxright *= cap;
       }
@@ -138,16 +150,7 @@
 
       shade = blackflag ? shade = 0xff : shades[shadeindex][y % 8];
 
-      /* first copy the stuff */
-      for( x = 0; x < (int)moondata->width/8; ++x )
-      {
-         if( moondata->bitmap[x + moonoff] )
-         {
-            image->bitmap[x + imageoff] = moondata->bitmap[x + moonoff];
-         }
-      }
-
-      /* now, hack the bits */
+      /* finally, hack the bits */
       if( bytexleft == bytexright )
       {
          image->bitmap[bytexleft + imageoff] &=

Reply via email to