Fix linrad on latest gcc
I checked linrad upstream, and they still haven't fixed these two bugs. I am surprised they haven't been reported yet. Without these fixes, linrad cannot be built with gcc5. the menu.c patch simply reverses the order of the condition. One must check the bounds constraint first! It's a pretty dumb mistake but I've seen this kind before. The second one fails because -Werror is set. This took me a while because I couldn't figure out the relationship between ADCHANS and rxchan. In any case, setting 4 locations per channel did indeed allow the array to be big enough. (at first I thought the loop was running too high, but I finally determined the array was too small). These were found on DragonFly that uses gcc5. This patch has not been tested on FreeBSD but I can't how it could possibly fail. It would be good if the ham@ maintainer reports the issue upstream. Updated patch files using make makepatch PR: ports/199737 Submitted by: marino
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
# Created by: db
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= linrad
|
||||
PORTVERSION= 4.02
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= comms hamradio
|
||||
MASTER_SITES= http://www.nitehawk.com/sm5bsz/linuxdsp/archive/\
|
||||
http://g7rau.demon.co.uk/sm5bsz/linuxdsp/archive/\
|
||||
@@ -33,8 +32,6 @@ LINRAD_DOCFILES= z_APM.txt z_BUFFERS.txt z_CALIBRATE.txt \
|
||||
z_PARALLEL_PORT.txt z_SETTINGS.txt \
|
||||
z_USERS_EXTRA.txt z_USERS_HWARE.txt
|
||||
|
||||
OPTIONS_DEFINE= DOCS
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
.if ${ARCH} == "i386"
|
||||
BINFILE= xlinrad
|
||||
@@ -66,11 +63,9 @@ do-install:
|
||||
# Some day we may want the svga version as well.
|
||||
# ${INSTALL_PROGRAM} -m0555 ${WRKSRC}/${PORTNAME} $(STAGEDIR}${PREFIX}/bin/${PORTNAME}.svga
|
||||
${INSTALL_PROGRAM} -m0555 ${WRKSRC}/${BINFILE} ${STAGEDIR}${PREFIX}/bin/x${PORTNAME}
|
||||
.if ${PORT_OPTIONS:MDOCS}
|
||||
${MKDIR} ${STAGEDIR}${DOCSDIR}
|
||||
.for f in ${LINRAD_DOCFILES}
|
||||
@${INSTALL_DATA} ${WRKSRC}/$f ${STAGEDIR}${DOCSDIR}/$f
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--- Makefile.in.orig 2014-11-04 02:25:00.000000000 -0800
|
||||
+++ Makefile.in 2014-12-08 03:03:40.000000000 -0800
|
||||
--- Makefile.in.orig 2014-11-04 10:25:00 UTC
|
||||
+++ Makefile.in
|
||||
@@ -23,7 +23,7 @@
|
||||
#
|
||||
# ----------- Compilers ----------------
|
||||
@@ -9,7 +9,7 @@
|
||||
# Name the output files *.ol instead of *.o
|
||||
# so we definitely know it is for Linux.
|
||||
# (*.o files can be present by mistake)
|
||||
@@ -42,7 +42,7 @@
|
||||
@@ -42,7 +42,7 @@ WINNASM64 = C:\mingw\bin\nasm -w-orphan-
|
||||
# (*.o files can be present by mistake)
|
||||
# Always use the same flags.
|
||||
# -Wconversion -Wno-sign-conversion -Wunreachable-code
|
||||
@@ -18,7 +18,7 @@
|
||||
-DSHM_INSTALLED=@LIBXEXT32_OK@ -Wimplicit \
|
||||
-DALSA_PRESENT=@ALSA32_OK@ -DIA64=0 \
|
||||
@DARWIN@ -DLIBUDEV_PRESENT=@LIBUDEV_32_OK@ -DSERVER=@MAKE_SERVER@ \
|
||||
@@ -50,7 +50,7 @@
|
||||
@@ -50,7 +50,7 @@ CFL = -g -O2 -DOSNUM=1 -DMEMREF_T=int @X
|
||||
-Wuninitialized -Wparentheses -Wstrict-prototypes -Werror -ffast-math \
|
||||
-Wundef -fomit-frame-pointer -c -o
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
-DCPU=@CPU@ -DSHM_INSTALLED=@LIBXEXT32_OK@ -Wimplicit \
|
||||
-DALSA_PRESENT=@ALSA32_OK@ -DIA64=0 \
|
||||
@DARWIN@ -DLIBUDEV_PRESENT=@LIBUDEV_32_OK@ -DSERVER=@MAKE_SERVER@ \
|
||||
@@ -58,13 +58,13 @@
|
||||
@@ -58,13 +58,13 @@ CFLN = -g -O2 -DOSNUM=1 -DMEMREF_T=int @
|
||||
-Wuninitialized -Wparentheses -Wstrict-prototypes -Werror -ffast-math \
|
||||
-Wundef -fomit-frame-pointer -c -o
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
-DCPU=@CPU@ -DSHM_INSTALLED=@LIBXEXT64_OK@ -DALSA_PRESENT=@ALSA64_OK@ \
|
||||
-DIA64=1 @DARWIN@ -DLIBUDEV_PRESENT=@LIBUDEV_64_OK@ -DSERVER=@MAKE_SERVER@ \
|
||||
-Wimplicit -Wreturn-type -Wformat -m64 -Wunused -Wcomment \
|
||||
@@ -1040,7 +1040,7 @@
|
||||
@@ -1040,7 +1040,7 @@ fcdpp.ol hid.ol pcie9842.ol bladerf.ol m
|
||||
@SVGA32_LD@ \
|
||||
@SVGAGL32_LD@ \
|
||||
@LIBUDEV_32_LD@ \
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
@echo " "
|
||||
@echo "You may want to disable pulseaudio in Ubuntu with this command:"
|
||||
@@ -1137,7 +1137,7 @@
|
||||
@@ -1137,7 +1137,7 @@ fcdpp.ol hid.ol pcie9842.ol bladerf.ol m
|
||||
@X11_32_LD@ \
|
||||
@ALSA32_LD@ \
|
||||
@LIBUDEV_32_LD@ \
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
@echo " "
|
||||
@echo "You may want to disable pulseaudio in Ubuntu with this command:"
|
||||
@@ -1210,7 +1210,7 @@
|
||||
@@ -1210,7 +1210,7 @@ fcdpp.ol hid.ol pcie9842.ol bladerf.ol m
|
||||
@SVGA32_LD@ \
|
||||
@SVGAGL32_LD@ \
|
||||
@LIBUDEV_32_LD@ \
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
@echo " "
|
||||
@echo "You may want to disable pulseaudio in Ubuntu with this command:"
|
||||
@@ -1527,7 +1527,7 @@
|
||||
@@ -1527,7 +1527,7 @@ fcdpp.om hid.om pcie9842.om bladerf.om m
|
||||
@SVGA64_LD@ \
|
||||
@SVGAGL64_LD@ \
|
||||
@LIBUDEV_64_LD@ \
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
@echo " "
|
||||
@echo "You may want to disable pulseaudio in Ubuntu with this command:"
|
||||
@@ -1612,7 +1612,7 @@
|
||||
@@ -1612,7 +1612,7 @@ elektor.om fcdpp.om hid.om pcie9842.om b
|
||||
@ALSA64_LD@ \
|
||||
@X11_64_LD@ \
|
||||
@LIBUDEV_64_LD@ \
|
||||
@@ -88,7 +88,7 @@
|
||||
|
||||
@echo " "
|
||||
@echo "You may want to disable pulseaudio in Ubuntu with this command:"
|
||||
@@ -1686,7 +1686,7 @@
|
||||
@@ -1686,7 +1686,7 @@ elektor.om fcdpp.om hid.om pcie9842.om b
|
||||
@SVGA64_LD@ \
|
||||
@SVGAGL64_LD@ \
|
||||
@LIBUDEV_64_LD@ \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- buf.c.orig 2014-06-27 18:11:24.000000000 -0700
|
||||
+++ buf.c 2014-06-27 18:11:33.000000000 -0700
|
||||
@@ -1292,7 +1292,7 @@
|
||||
--- buf.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ buf.c
|
||||
@@ -1328,7 +1328,7 @@ if( (ui.network_flag & NET_RXIN_FFT1) ==
|
||||
memset(fft1_char,0,fft1_bytes);
|
||||
memset(liminfo,0,2*fft1_size*sizeof(float));
|
||||
memset(liminfo_wait,0,fft1_size*sizeof(unsigned char));
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- caliq.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ caliq.c
|
||||
@@ -391,7 +391,7 @@ char s[80];
|
||||
int seg,color;
|
||||
int ia,ib;
|
||||
int i,j,k,m,n,mm,errskip;
|
||||
-float z[2*MAX_ADCHAN];
|
||||
+float z[4*MAX_ADCHAN];
|
||||
float t1,t2,t3;
|
||||
caliq_clear_flag=TRUE;
|
||||
clear_fft1_filtercorr();
|
||||
@@ -1,6 +1,6 @@
|
||||
--- configure.orig 2014-11-04 02:25:00.000000000 -0800
|
||||
+++ configure 2014-12-09 10:52:10.000000000 -0800
|
||||
@@ -1832,11 +1832,6 @@
|
||||
--- configure.orig 2014-11-04 10:25:00 UTC
|
||||
+++ configure
|
||||
@@ -1832,11 +1832,6 @@ fi
|
||||
ELF32=""
|
||||
ELF64=""
|
||||
if test ${OS} != "Darwin"; then
|
||||
@@ -12,7 +12,7 @@
|
||||
ELF64="-felf64"
|
||||
LIBEXT="so"
|
||||
S_OS_TYPE="OS_LINUX"
|
||||
@@ -1853,7 +1848,9 @@
|
||||
@@ -1853,7 +1848,9 @@ else
|
||||
fi
|
||||
|
||||
# Find out whether we have gcc
|
||||
@@ -23,7 +23,7 @@
|
||||
# Extract the first word of "${CC} ", so it can be a program name with args.
|
||||
set dummy ${CC} ; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -4025,6 +4022,9 @@
|
||||
@@ -4025,6 +4022,9 @@ ALSA32_OK="0"
|
||||
ALSA64_OK="0"
|
||||
ALSA32_INSTALLED="0"
|
||||
ALSA64_INSTALLED="0"
|
||||
@@ -33,7 +33,7 @@
|
||||
ALSA32_LD="libasound.${LIBEXT}"
|
||||
X=`./libfind1 libasound.${LIBEXT}`
|
||||
ALSA32_INC=`./libfind2 1 "$X"`
|
||||
@@ -4090,6 +4090,7 @@
|
||||
@@ -4090,6 +4090,7 @@ if test "$ALSA64_OK" = "1"; then
|
||||
ALSA64_LD=""
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- elektor.c.orig 2014-12-08 03:00:20.000000000 -0800
|
||||
+++ elektor.c 2014-12-08 03:00:29.000000000 -0800
|
||||
@@ -1020,7 +1020,7 @@
|
||||
--- elektor.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ elektor.c
|
||||
@@ -1018,7 +1018,7 @@ void update_elektor_rx_frequency()
|
||||
|
||||
//fprintf( stderr,"update-freq() cntrfreq=%f, hwfreq=%f\n",fg.passband_center,hwfreq);
|
||||
// This routine is called from the screen thread.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- help.c.orig 2014-03-20 18:05:17.000000000 -0700
|
||||
+++ help.c 2014-06-27 21:52:48.000000000 -0700
|
||||
@@ -584,7 +584,10 @@
|
||||
--- help.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ help.c
|
||||
@@ -583,7 +583,10 @@ void write_from_msg_file(int *line, int
|
||||
char s[512];
|
||||
char chr;
|
||||
int i,j,k;
|
||||
-msg_file=fopen(msg_filename, "r");
|
||||
+char *fn;
|
||||
+asprintf(&fn, "%s/%s", "%%DATADIR%%", msg_filename);
|
||||
+asprintf(&fn, "%s/%s", "/usr/local/share/linrad/", msg_filename);
|
||||
+msg_file=fopen(fn, "r");
|
||||
+free(fn);
|
||||
if(msg_file == NULL)
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
--- libfind1.c.orig 2014-03-20 18:05:17.000000000 -0700
|
||||
+++ libfind1.c 2014-06-27 21:45:49.000000000 -0700
|
||||
@@ -38,7 +38,9 @@
|
||||
"/usr/lib64/lib",
|
||||
--- libfind1.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ libfind1.c
|
||||
@@ -39,6 +39,8 @@ char *dirs[]={"/lib/i386-linux-gnu",
|
||||
"/usr/lib32",
|
||||
"/usr/lib64",
|
||||
- "/usr/local/lib",
|
||||
+ "%%LOCALBASE%%lib",
|
||||
+ "%%LOCALBASE%%lib/portaudio2",
|
||||
+ "%%LOCALBASE%%lib32",
|
||||
"/usr/local/lib",
|
||||
+ "/usr/local/lib/portaudio2",
|
||||
+ "/usr/local/lib32",
|
||||
"/usr/local/lib64",
|
||||
"/usr/local32/lib",
|
||||
"/usr/lib",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- libfind2.c.orig 2014-06-27 19:49:15.000000000 -0700
|
||||
+++ libfind2.c 2014-06-27 19:50:30.000000000 -0700
|
||||
@@ -83,7 +83,7 @@
|
||||
--- libfind2.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ libfind2.c
|
||||
@@ -83,7 +83,7 @@ findlinux:;
|
||||
argv[2][i-2] == '1' &&
|
||||
argv[2][i-1] == '1')
|
||||
{
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,7 +140,7 @@
|
||||
@@ -140,7 +140,7 @@ findlinux:;
|
||||
argv[2][i-6] == '1' &&
|
||||
argv[2][i-5] == '1')
|
||||
{
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -211,7 +211,7 @@
|
||||
@@ -211,7 +211,7 @@ findmac:;
|
||||
argv[2][i-2] == '1' &&
|
||||
argv[2][i-1] == '1')
|
||||
{
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -257,7 +257,7 @@
|
||||
@@ -257,7 +257,7 @@ findmac:;
|
||||
argv[2][i-2] == '1' &&
|
||||
argv[2][i-1] == '1')
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--- loadusb.h.orig 2014-12-08 03:09:37.000000000 -0800
|
||||
+++ loadusb.h 2014-12-08 03:10:07.000000000 -0800
|
||||
--- loadusb.h.orig 2014-11-04 10:25:00 UTC
|
||||
+++ loadusb.h
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#if OSNUM == OSNUM_LINUX
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
--- lxsys.c.orig 2014-12-08 03:10:46.000000000 -0800
|
||||
+++ lxsys.c 2014-12-08 03:11:39.000000000 -0800
|
||||
@@ -120,9 +120,9 @@
|
||||
--- lxsys.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ lxsys.c
|
||||
@@ -63,7 +63,7 @@ int open_USB2LPT(void);
|
||||
|
||||
struct termios old_options;
|
||||
#ifdef BSD
|
||||
-char serport_name[]="/dev/ttyd....";
|
||||
+char serport_name[]="/dev/ttyu....";
|
||||
#else
|
||||
char serport_name[]="/dev/ttyS....?";
|
||||
#endif
|
||||
@@ -120,9 +120,9 @@ char *fmmx=" mmx";
|
||||
char *fsse=" sse";
|
||||
char *fht=" ht";
|
||||
char *fprocessor="processor";
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--- menu.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ menu.c
|
||||
@@ -965,11 +965,13 @@ if(parnum == SECOND_FFT_ATT_N)
|
||||
{
|
||||
k[0]=fft2_n-2;
|
||||
}
|
||||
+// Please check if index is within constaints *BEFORE* using it.
|
||||
+// This error was caught by GCC5 diagnostics marino@FreeBSD.org
|
||||
if(parnum == SECOND_FFT_VERNR)
|
||||
{
|
||||
i=0;
|
||||
- while( fft2_version[ui.rx_rf_channels-1][i+1] > 0 &&
|
||||
- i < MAX_FFT2_VERNR-1)i++;
|
||||
+ while( i < MAX_FFT2_VERNR-1 &&
|
||||
+ fft2_version[ui.rx_rf_channels-1][i+1] > 0)i++;
|
||||
if(mmx_present == 0)
|
||||
{
|
||||
while( fft_cntrl[fft2_version[ui.rx_rf_channels-1][i]].mmx != 0)i--;
|
||||
@@ -1,6 +1,6 @@
|
||||
--- users.c.orig 2014-06-28 18:33:12.000000000 -0700
|
||||
+++ users.c 2014-06-28 18:33:19.000000000 -0700
|
||||
@@ -130,6 +130,7 @@
|
||||
--- users.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ users.c
|
||||
@@ -130,6 +130,7 @@ void userdefined_q(void)
|
||||
// Leaving the port open the whole time could leave it in an
|
||||
// undefined state if Linrad crashes.
|
||||
//
|
||||
@@ -8,7 +8,7 @@
|
||||
int n;
|
||||
int serport_baudrate;
|
||||
int serport_stopbits;
|
||||
@@ -142,6 +143,7 @@
|
||||
@@ -142,6 +143,7 @@ lir_open_serport(SERPORT_NUMBER,
|
||||
0); // RTS mode = 0
|
||||
n=lir_write_serport(serport_message,10);
|
||||
lir_close_serport();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- wse_sdrxx.c.orig 2014-11-04 02:25:00.000000000 -0800
|
||||
+++ wse_sdrxx.c 2014-12-08 03:15:31.000000000 -0800
|
||||
@@ -219,9 +219,9 @@
|
||||
--- wse_sdrxx.c.orig 2014-11-04 10:25:00 UTC
|
||||
+++ wse_sdrxx.c
|
||||
@@ -219,9 +219,9 @@ if(ui.rx_addev_no == RTL2832_DEVICE_CODE
|
||||
m=10000;
|
||||
for(i=0; i<no_of_rtl2832_gains; i++)
|
||||
{
|
||||
@@ -12,7 +12,7 @@
|
||||
j=i;
|
||||
}
|
||||
}
|
||||
@@ -265,9 +265,9 @@
|
||||
@@ -265,9 +265,9 @@ if(ui.rx_addev_no == MIRISDR_DEVICE_CODE
|
||||
m=10000;
|
||||
for(i=0; i<no_of_mirics_gains; i++)
|
||||
{
|
||||
|
||||
+12
-12
@@ -2,15 +2,15 @@ bin/linrad
|
||||
bin/xlinrad
|
||||
%%DATADIR%%/errors.lir
|
||||
%%DATADIR%%/help.lir
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_APM.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_BUFFERS.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_CALIBRATE.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_COPYRIGHT.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_GIFINFO.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_MORSE_DECODING.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_MOUSE.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_NETWORK.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_PARALLEL_PORT.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_SETTINGS.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_USERS_EXTRA.txt
|
||||
%%PORTDOCS%%%%DOCSDIR%%/z_USERS_HWARE.txt
|
||||
%%DOCSDIR%%/z_APM.txt
|
||||
%%DOCSDIR%%/z_BUFFERS.txt
|
||||
%%DOCSDIR%%/z_CALIBRATE.txt
|
||||
%%DOCSDIR%%/z_COPYRIGHT.txt
|
||||
%%DOCSDIR%%/z_GIFINFO.txt
|
||||
%%DOCSDIR%%/z_MORSE_DECODING.txt
|
||||
%%DOCSDIR%%/z_MOUSE.txt
|
||||
%%DOCSDIR%%/z_NETWORK.txt
|
||||
%%DOCSDIR%%/z_PARALLEL_PORT.txt
|
||||
%%DOCSDIR%%/z_SETTINGS.txt
|
||||
%%DOCSDIR%%/z_USERS_EXTRA.txt
|
||||
%%DOCSDIR%%/z_USERS_HWARE.txt
|
||||
|
||||
Reference in New Issue
Block a user