More updates, large makefile rewrite for dynamic linking and cleaner

build, WIP.
This commit is contained in:
Hibby 2024-11-29 01:35:56 +00:00
parent 1e83f7e725
commit c77b3e9f47
No known key found for this signature in database
6 changed files with 200 additions and 15 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.pc/
*.swp

10
debian/changelog vendored
View File

@ -1,6 +1,6 @@
linbpq (6.0.24.51-1~hibbian+1) UNRELEASED; urgency=medium
* New upstream import
* New upstream import
- Patches refreshed
-- Dave Hibberd <hibby@debian.org> Thu, 28 Nov 2024 22:34:23 +0000
@ -14,7 +14,7 @@ linbpq (6.0.24.50-1~hibbian+1) bookworm-hibbian-unstable; urgency=medium
linbpq (6.0.24.49-1~hibbian+1) bookworm-hibbian-unstable; urgency=medium
* New Upstream import
* New Upstream import
* Patches refreshed
* Add mqtt requirements
@ -29,7 +29,7 @@ linbpq (6.0.24.45-1~hibbian+1) bookworm-hibbian-unstable; urgency=medium
linbpq (6.0.24.42-1~hibbian+3) bookworm-hibbian-unstable; urgency=medium
* 32bit build error
* 32bit build error
- Patch updated to fix hopefully
-- Dave Hibberd <hibby@debian.org> Fri, 30 Aug 2024 12:21:57 +0100
@ -43,7 +43,7 @@ linbpq (6.0.24.42-1~hibbian+2) bookworm-hibbian-unstable; urgency=medium
linbpq (6.0.24.42-1~hibbian+1) bookworm-hibbian-unstable; urgency=medium
* Install config to /etc
* New upstream update
* New upstream update
* Patches refreshed
* Debian hardening enabled
- 2 new patches created that touch almost every file
@ -56,7 +56,7 @@ linbpq (6.0.24.40-1) unstable; urgency=medium
* Fresh upstream release
- Patches refreshed
* Secure by default patch
* Secure by default patch
-- Dave Hibberd <hibby@debian.org> Sun, 07 Jul 2024 16:09:28 +0100

View File

@ -9,6 +9,24 @@
memcpy(&rlen, &Decoded[5], 4);
@@ -1612,7 +1612,7 @@
if (Sess ==NULL)
return 0;
- Len = sprintf(Reply, StatusPage);
+ Len = sprintf(Reply, "%s", StatusPage);
while (Sess)
{
@@ -1670,7 +1670,7 @@
Sess = Sess->Next;
}
- Len += sprintf(&Reply[Len], StatusTail);
+ Len += sprintf(&Reply[Len], "%s", StatusTail);
return Len;
}
--- a/bpqmail.h
+++ b/bpqmail.h
@@ -611,7 +611,7 @@
@ -16,10 +34,23 @@
int number;
int length;
- int xdatereceived;
+ const time_t xdatereceived;
+ time_t xdatereceived;
char bbsfrom[7]; // ? BBS we got it from ?
char via[41];
char from[7];
@@ -643,9 +643,9 @@
// For 64 bit time_t compatibility define as long long
// (so struct is same with 32 or 64 bit time_t)
- long long datereceived;
- long long datecreated;
- long long datechanged;
+ time_t datereceived;
+ time_t datecreated;
+ time_t datechanged;
char Spare[61 - 24]; // For future use
} ;
@@ -695,8 +695,8 @@
unsigned char Type;
unsigned char changed;
@ -42,3 +73,112 @@
int AGWDataSocket_Disconnect( struct AGWSocketConnectionInfo * sockptr);
int SendRawPacket(struct AGWSocketConnectionInfo * sockptr, char *txmsg, int Length);
int ShowApps();
--- a/APRSCode.c
+++ b/APRSCode.c
@@ -7666,7 +7666,7 @@
}
- OutputLen += sprintf(&OutBuffer[OutputLen], WebTrailer);
+ OutputLen += sprintf(&OutBuffer[OutputLen], "%s", WebTrailer);
HeaderLen = sprintf(Header, "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n", OutputLen);
sendandcheck(sock, Header, HeaderLen);
@@ -7711,7 +7711,7 @@
}
- OutputLen += sprintf(&OutBuffer[OutputLen], WebTrailer);
+ OutputLen += sprintf(&OutBuffer[OutputLen], "%s", WebTrailer);
HeaderLen = sprintf(Header, "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n", OutputLen);
sendandcheck(sock, Header, HeaderLen);
--- a/LinBPQ.c
+++ b/LinBPQ.c
@@ -667,7 +667,7 @@
// Replace CR with CRLF
- printf(ptr);
+ printf("%c", ptr);
if (ptr2)
printf("\r\n");
@@ -816,7 +816,7 @@
{
case 'h':
- printf(HelpScreen);
+ printf("%c", HelpScreen);
exit (0);
case 'l':
--- a/RigControl.c
+++ b/RigControl.c
@@ -1291,7 +1291,7 @@
// use text command
- Len = sprintf(CmdPtr, ptr1);
+ Len = sprintf(CmdPtr,"%c", ptr1);
break;
case YAESU:
--- a/FreeDATA.c
+++ b/FreeDATA.c
@@ -867,7 +867,7 @@
char Message[256];
int Len, ret;
- Len = sprintf(Message, TXF);
+ Len = sprintf(Message,"%c",TXF);
ret = send(TNC->TCPDataSock, (char *)&Message, Len, 0);
if (buffptr)
@@ -2476,7 +2476,7 @@
char Message[256];
int Len, ret;
- Len = sprintf(Message, CQ);
+ Len = sprintf(Message, "%c", CQ);
ret = send(TNC->TCPDataSock, (char *)&Message, Len, 0);
}
@@ -2491,7 +2491,7 @@
if (Interval > 0)
Len = sprintf(Message, Template1, Interval);
else
- Len = sprintf(Message, Template2);
+ Len = sprintf(Message, "%c", Template2);
ret = send(TNC->TCPDataSock, (char *)&Message, Len, 0);
}
@@ -3682,7 +3682,7 @@
// return FreeDataSendCommand(TNC, "D");
- Len = sprintf(Msg, Disconnect);
+ Len = sprintf(Msg,"%c", Disconnect);
return send(TNC->TCPDataSock, Msg, Len, 0);
}
@@ -3694,7 +3694,7 @@
char Msg[128];
int Len;
- Len = sprintf(Msg, GetData);
+ Len = sprintf(Msg, "%c", GetData);
return send(TNC->TCPDataSock, Msg, Len, 0);
}
--- a/rigcontrol.h
+++ b/rigcontrol.h
@@ -2,7 +2,7 @@
#define RIGCONTROL
#ifndef LINBPQ
-#include "Rigresource.h"
+#include "rigresource.h"
#endif
#define IDI_ICON2 2

View File

@ -1,21 +1,66 @@
--- a/makefile
+++ b/makefile
@@ -33,11 +33,14 @@
@@ -2,7 +2,7 @@
linbpq: $(OBJS)
gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lrt -lm -lz $(LDFLAGS) -lpthread -lconfig -lpcap -o linbpq
# To exclude i2c support run make noi2c
-OBJS = pngwtran.o pngrtran.o pngset.o pngrio.o pngwio.o pngtrans.o pngrutil.o pngwutil.o\
+COMPLETE_SRC = pngwtran.o pngrtran.o pngset.o pngrio.o pngwio.o pngtrans.o pngrutil.o pngwutil.o\
pngread.o pngwrite.o png.o pngerror.o pngget.o pngmem.o APRSIconData.o AISCommon.o\
upnp.o APRSStdPages.o HSMODEM.o WinRPR.o KISSHF.o TNCEmulators.o bpqhdlc.o SerialPort.o\
adif.o WebMail.o utf8Routines.o VARA.o LzFind.o Alloc.o LzmaDec.o LzmaEnc.o LzmaLib.o \
@@ -18,26 +18,41 @@
# Configuration:
CC = gcc
-
-all: CFLAGS = -DLINBPQ -MMD -g -fcommon
-all: LDFLAGS = -l:libpaho-mqtt3a.a -l:libjansson.a
-all: linbpq
+LD = $(CC)
+CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
+CFLAGS+=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS+=-DLINBPQ
+LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
+
+$(warning CFLAGS are $(CFLAGS))
+
+LIBS = -lrt -lm -lz -lpthread -lconfig -lpcap -lpaho-mqtt3a -ljansson -lminiupnpc
-nomqtt: CFLAGS = -DLINBPQ -MMD -fcommon -g -DNOMQTT
+
+all: linbpq
+
+nomqtt: CFLAGS += -DNOMQTT
nomqtt: linbpq
-noi2c: CFLAGS = -DLINBPQ -MMD -DNOI2C -g -fcommon
+noi2c: CFLAGS += -DNOI2C
noi2c: linbpq
+COMPLETE_OBJS = $(COMPLETE_SRC:.c=o)
-linbpq: $(OBJS)
- gcc $(OBJS) -Xlinker -Map=output.map -l:libminiupnpc.a -lrt -lm -lz $(LDFLAGS) -lpthread -lconfig -lpcap -o linbpq
- sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
+ # sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
+.c.o:
+ $(CC) $(CFLAGS) $(LDFLAGS) -c $<
-include *.d
--include *.d
-clean :
- rm *.d
- rm linbpq $(OBJS)
+linbpq: $(COMPLETE_OBJS)
+ $(LD) $(LDFLAGS) -o linbpq $(COMPLETE_OBJS) $(LIBS)
+
+-include *.d
+install:
+ install -b -m 755 -D -d debian/linbpq/usr/sbin
+ install -b -m 755 -s -p linbpq debian/linbpq/usr/sbin
+ install -b -m 755 -p linbpq debian/linbpq/usr/sbin
+
+clean:
+ $(RM) *.d
+ $(RM) linbpq $(OBJS)

View File

@ -2,4 +2,3 @@ headers.patch
ftbfs-gcc14.patch
spelling-errors.patch
makefile
secure-by-default.patch

2
debian/rules vendored
View File

@ -1,6 +1,6 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-format qa=-bug-implicit-func
%:
dh $@