diff options
author | db <db@FreeBSD.org> | 2016-04-26 03:45:33 +0800 |
---|---|---|
committer | db <db@FreeBSD.org> | 2016-04-26 03:45:33 +0800 |
commit | 416b6219edffe930d12e1c168da4a9a117e719c1 (patch) | |
tree | 2419f35b533fde81eecd9ab34de7f6738b711719 /comms | |
parent | 4b4d6fb2baab471c271bdea1ddc305be3e457682 (diff) | |
download | freebsd-ports-gnome-416b6219edffe930d12e1c168da4a9a117e719c1.tar.gz freebsd-ports-gnome-416b6219edffe930d12e1c168da4a9a117e719c1.tar.zst freebsd-ports-gnome-416b6219edffe930d12e1c168da4a9a117e719c1.zip |
Add back libfec
Remove support for obsolete FreeBSD versions
Reassign maintainer to hamradio@
Cleanups to make sure it compiles cleanly on clang and gcc
Cleanup to (hopefully) allow building on non x86 architectures (untested)
Diffstat (limited to 'comms')
-rw-r--r-- | comms/Makefile | 1 | ||||
-rw-r--r-- | comms/libfec/Makefile | 49 | ||||
-rw-r--r-- | comms/libfec/distinfo | 2 | ||||
-rw-r--r-- | comms/libfec/files/cpu_mode.c | 50 | ||||
-rw-r--r-- | comms/libfec/files/patch-configure.in | 27 | ||||
-rw-r--r-- | comms/libfec/files/patch-dotprod.c | 24 | ||||
-rw-r--r-- | comms/libfec/files/patch-fec.h | 11 | ||||
-rw-r--r-- | comms/libfec/files/patch-makefile.in | 193 | ||||
-rw-r--r-- | comms/libfec/pkg-descr | 20 |
9 files changed, 377 insertions, 0 deletions
diff --git a/comms/Makefile b/comms/Makefile index f15fa8d7e728..daae68c0ebcd 100644 --- a/comms/Makefile +++ b/comms/Makefile @@ -81,6 +81,7 @@ SUBDIR += libcodec2 SUBDIR += libconcord SUBDIR += libfap + SUBDIR += libfec SUBDIR += libimobiledevice SUBDIR += libirman SUBDIR += libmodbus diff --git a/comms/libfec/Makefile b/comms/libfec/Makefile new file mode 100644 index 000000000000..6f41d8cb07bc --- /dev/null +++ b/comms/libfec/Makefile @@ -0,0 +1,49 @@ +# Created by: db +# $FreeBSD$ + +PORTNAME= libfec +PORTVERSION= 3.0.1 +PORTREVISION= 2 +CATEGORIES= comms astro hamradio math +MASTER_SITES= http://www.ka9q.net/code/fec/ \ + LOCAL/db +DISTNAME= fec-${PORTVERSION} + +MAINTAINER= hamradio@FreeBSD.org +COMMENT= Several forward error correction (FEC) decoders + +LICENSE= LGPL21 + +MAKEFILE= makefile + +GNU_CONFIGURE= yes +USES= autoreconf gmake tar:bzip2 +USE_LDCONFIG= yes +PLIST_FILES= include/fec.h \ + lib/libfec.so \ + lib/libfec.a \ + man/man3/dsp.3.gz \ + man/man3/rs.3.gz \ + man/man3/simd-viterbi.3.gz + +.include <bsd.port.pre.mk> + +.if ${ARCH} == "amd64" +CFLAGS+= -fPIC +.endif + +post-patch: + @${CP} ${FILESDIR}/cpu_mode.c ${WRKSRC} + +do-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/include + @${MKDIR} ${STAGEDIR}${PREFIX}/lib + @${MKDIR} ${STAGEDIR}${MAN3PREFIX}/man/man3 + ${INSTALL_DATA} ${WRKSRC}/fec.h ${STAGEDIR}${PREFIX}/include + ${INSTALL_DATA} ${WRKSRC}/libfec.a ${STAGEDIR}${PREFIX}/lib + ${INSTALL_LIB} ${WRKSRC}/libfec.so ${STAGEDIR}${PREFIX}/lib +.for _man in dsp.3 simd-viterbi.3 rs.3 + ${INSTALL_MAN} ${WRKSRC}/${_man} ${STAGEDIR}${MAN3PREFIX}/man/man3 +.endfor + +.include <bsd.port.post.mk> diff --git a/comms/libfec/distinfo b/comms/libfec/distinfo new file mode 100644 index 000000000000..215558c3575d --- /dev/null +++ b/comms/libfec/distinfo @@ -0,0 +1,2 @@ +SHA256 (fec-3.0.1.tar.bz2) = 4201f6c80fe3fb283806bf41a74ea3476d783081e7cd6d09f12406894e6f567c +SIZE (fec-3.0.1.tar.bz2) = 101479 diff --git a/comms/libfec/files/cpu_mode.c b/comms/libfec/files/cpu_mode.c new file mode 100644 index 000000000000..089c416c2e9c --- /dev/null +++ b/comms/libfec/files/cpu_mode.c @@ -0,0 +1,50 @@ +/* Determine CPU support for SIMD + * Copyright 2004 Phil Karn, KA9Q + */ +#include <stdio.h> +#include "fec.h" +#ifdef __VEC__ +#include <sys/sysctl.h> +#endif + +/* Various SIMD instruction set names */ +char *Cpu_modes[] = {"Unknown","Portable C","x86 Multi Media Extensions (MMX)", + "x86 Streaming SIMD Extensions (SSE)", + "x86 Streaming SIMD Extensions 2 (SSE2)", + "PowerPC G4/G5 Altivec/Velocity Engine"}; + +enum cpu_mode Cpu_mode; + +void find_cpu_mode(void){ + + int f; + if(Cpu_mode != UNKNOWN) + return; + else + Cpu_mode = PORT; +#ifdef __i386__ + /* Figure out what kind of CPU we have */ + f = cpu_features(); + if(f & (1<<26)){ /* SSE2 is present */ + Cpu_mode = SSE2; + } else if(f & (1<<25)){ /* SSE is present */ + Cpu_mode = SSE; + } else if(f & (1<<23)){ /* MMX is present */ + Cpu_mode = MMX; + } +#endif +//#ifdef __VEC__ +#if 0 +// This looks very Linux specific + { + /* Ask the OS if we have Altivec support */ + int selectors[2] = { CTL_HW, HW_VECTORUNIT }; + int hasVectorUnit = 0; + size_t length = sizeof(hasVectorUnit); + int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); + if(0 == error && hasVectorUnit) + Cpu_mode = ALTIVEC; + } +#endif + fprintf(stderr,"SIMD CPU detect: %s\n",Cpu_modes[Cpu_mode]); +} diff --git a/comms/libfec/files/patch-configure.in b/comms/libfec/files/patch-configure.in new file mode 100644 index 000000000000..1679520050c9 --- /dev/null +++ b/comms/libfec/files/patch-configure.in @@ -0,0 +1,27 @@ +--- configure.in.orig 2006-10-13 01:10:53 UTC ++++ configure.in +@@ -38,7 +38,7 @@ AC_CANONICAL_SYSTEM + case $target_cpu in + i386|i486|i586|i686) + ARCH_OPTION="-march=$target_cpu" +- MLIBS="viterbi27_mmx.o mmxbfly27.o viterbi27_sse.o ssebfly27.o viterbi27_sse2.o sse2bfly27.o \ ++ MLIBS="cpu_features.o viterbi27_mmx.o mmxbfly27.o viterbi27_sse.o ssebfly27.o viterbi27_sse2.o sse2bfly27.o \ + viterbi29_mmx.o mmxbfly29.o viterbi29_sse.o ssebfly29.o viterbi29_sse2.o sse2bfly29.o \ + viterbi39_sse2.o viterbi39_sse.o viterbi39_mmx.o \ + viterbi615_mmx.o viterbi615_sse.o viterbi615_sse2.o \ +@@ -50,13 +50,13 @@ i386|i486|i586|i686) + sumsq.o sumsq_port.o \ + sumsq_sse2.o sumsq_sse2_assist.o \ + sumsq_mmx.o sumsq_mmx_assist.o \ +- cpu_features.o cpu_mode_x86.o" ++ cpu_features.o" + ;; + powerpc*) + ARCH_OPTION="-fno-common -faltivec" + MLIBS="viterbi27_av.o viterbi29_av.o viterbi39_av.o viterbi615_av.o \ + encode_rs_av.o \ +- dotprod_av.o sumsq_av.o peakval_av.o cpu_mode_ppc.o" ++ dotprod_av.o sumsq_av.o peakval_av.o" + ;; + *) + MLIBS= diff --git a/comms/libfec/files/patch-dotprod.c b/comms/libfec/files/patch-dotprod.c new file mode 100644 index 000000000000..0393f0ec19f1 --- /dev/null +++ b/comms/libfec/files/patch-dotprod.c @@ -0,0 +1,24 @@ +--- dotprod.c.orig 2006-10-13 01:10:53 UTC ++++ dotprod.c +@@ -54,16 +54,21 @@ void freedp(void *p){ + switch(Cpu_mode){ + case PORT: + default: ++ return; ++ break; + #ifdef __i386__ + case MMX: + case SSE: + return freedp_mmx(p); ++ break; + case SSE2: + return freedp_sse2(p); ++ break; + #endif + #ifdef __VEC__ + case ALTIVEC: + return freedp_av(p); ++ break; + #endif + } + } diff --git a/comms/libfec/files/patch-fec.h b/comms/libfec/files/patch-fec.h new file mode 100644 index 000000000000..955b8abb20ae --- /dev/null +++ b/comms/libfec/files/patch-fec.h @@ -0,0 +1,11 @@ +--- fec.h.orig 2006-10-13 01:10:53 UTC ++++ fec.h +@@ -262,7 +262,7 @@ extern enum cpu_mode {UNKNOWN=0,PORT,MMX + void find_cpu_mode(void); /* Call this once at startup to set Cpu_mode */ + + /* Determine parity of argument: 1 = odd, 0 = even */ +-#ifdef __i386__ ++#ifdef notyet__i386__ + static inline int parityb(unsigned char x){ + __asm__ __volatile__ ("test %1,%1;setpo %0" : "=g"(x) : "r" (x)); + return x; diff --git a/comms/libfec/files/patch-makefile.in b/comms/libfec/files/patch-makefile.in new file mode 100644 index 000000000000..4eb4c27c2cef --- /dev/null +++ b/comms/libfec/files/patch-makefile.in @@ -0,0 +1,193 @@ +--- makefile.in.orig 2006-10-13 01:10:53 UTC ++++ makefile.in +@@ -8,7 +8,7 @@ prefix = @prefix@ + exec_prefix=@exec_prefix@ + VPATH = @srcdir@ + CC=@CC@ +-LIBS=@MLIBS@ fec.o sim.o viterbi27.o viterbi27_port.o viterbi29.o viterbi29_port.o \ ++LIBS=@MLIBS@ cpu_mode.o fec.o sim.o viterbi27.o viterbi27_port.o viterbi29.o viterbi29_port.o \ + viterbi39.o viterbi39_port.o \ + viterbi615.o viterbi615_port.o encode_rs_char.o encode_rs_int.o encode_rs_8.o \ + decode_rs_char.o decode_rs_int.o decode_rs_8.o \ +@@ -43,52 +43,50 @@ test: vtest27 vtest29 vtest39 vtest615 r + install: all + mkdir -p @libdir@ + install -m 644 -p $(SHARED_LIB) libfec.a @libdir@ +-# (cd @libdir@;ln -f -s $(SHARED_LIB) libfec.so) +- @REBIND@ + mkdir -p @includedir@ + install -m 644 -p fec.h @includedir@ + mkdir -m 0755 -p @mandir@/man3 + install -m 644 -p simd-viterbi.3 rs.3 dsp.3 @mandir@/man3 + + peaktest: peaktest.o libfec.a +- gcc -g -o $@ $^ ++ ${CC} -g -o $@ $^ + + sumsq_test: sumsq_test.o libfec.a +- gcc -g -o $@ $^ ++ ${CC} -g -o $@ $^ + + dtest: dtest.o libfec.a +- gcc -g -o $@ $^ -lm ++ ${CC} -g -o $@ $^ -lm + + vtest27: vtest27.o libfec.a +- gcc -g -o $@ $^ -lm ++ ${CC} -g -o $@ $^ -lm + + vtest29: vtest29.o libfec.a +- gcc -g -o $@ $^ -lm ++ ${CC} -g -o $@ $^ -lm + + vtest39: vtest39.o libfec.a +- gcc -g -o $@ $^ -lm ++ ${CC} -g -o $@ $^ -lm + + vtest615: vtest615.o libfec.a +- gcc -g -o $@ $^ -lm ++ ${CC} -g -o $@ $^ -lm + + rstest: rstest.o libfec.a +- gcc -g -o $@ $^ ++ ${CC} -g -o $@ $^ + + rs_speedtest: rs_speedtest.o libfec.a +- gcc -g -o $@ $^ ++ ${CC} -g -o $@ $^ + + # for some reason, the test programs without args segfault on the PPC with -O2 optimization. Dunno why - compiler bug? + vtest27.o: vtest27.c fec.h +- gcc -g -c $< ++ ${CC} -g -c $< + + vtest29.o: vtest29.c fec.h +- gcc -g -c $< ++ ${CC} -g -c $< + + vtest39.o: vtest39.c fec.h +- gcc -g -c $< ++ ${CC} -g -c $< + + vtest615.o: vtest615.c fec.h +- gcc -g -c $< ++ ${CC} -g -c $< + + libfec.a: $(LIBS) + ar rv $@ $^ +@@ -100,7 +98,7 @@ libfec.dylib: $(LIBS) + + # for Linux et al + libfec.so: $(LIBS) +- gcc -shared -Xlinker -soname=$@ -o $@ -Wl,-whole-archive $^ -Wl,-no-whole-archive -lc ++ ${CC} -shared -Xlinker -soname=$@ -o $@ -Wl,-whole-archive $^ -Wl,-no-whole-archive -lc + + dotprod.o: dotprod.c fec.h + +@@ -146,10 +144,10 @@ ccsds_tab.c: gen_ccsds + ./gen_ccsds > ccsds_tab.c + + gen_ccsds: gen_ccsds.o init_rs_char.o +- gcc -o $@ $^ ++ ${CC} -o $@ $^ + + gen_ccsds.o: gen_ccsds.c +- gcc $(CFLAGS) -c -o $@ $< ++ ${CC} $(CFLAGS) -c -o $@ $< + + ccsds_tal.o: ccsds_tal.c + +@@ -157,16 +155,16 @@ ccsds_tal.c: gen_ccsds_tal + ./gen_ccsds_tal > ccsds_tal.c + + exercise_char.o: exercise.c +- gcc $(CFLAGS) -c -o $@ $< ++ ${CC} $(CFLAGS) -c -o $@ $< + + exercise_int.o: exercise.c +- gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $< ++ ${CC} -DBIGSYM=1 $(CFLAGS) -c -o $@ $< + + exercise_8.o: exercise.c +- gcc -DFIXED=1 $(CFLAGS) -c -o $@ $< ++ ${CC} -DFIXED=1 $(CFLAGS) -c -o $@ $< + + exercise_ccsds.o: exercise.c +- gcc -DCCSDS=1 $(CFLAGS) -c -o $@ $< ++ ${CC} -DCCSDS=1 $(CFLAGS) -c -o $@ $< + + viterbi27.o: viterbi27.c fec.h + +@@ -175,13 +173,13 @@ viterbi27_port.o: viterbi27_port.c fec.h + viterbi27_av.o: viterbi27_av.c fec.h + + viterbi27_mmx.o: viterbi27_mmx.c fec.h +- gcc $(CFLAGS) -mmmx -c -o $@ $< ++ ${CC} $(CFLAGS) -mmmx -c -o $@ $< + + viterbi27_sse.o: viterbi27_sse.c fec.h +- gcc $(CFLAGS) -msse -c -o $@ $< ++ ${CC} $(CFLAGS) -msse -c -o $@ $< + + viterbi27_sse2.o: viterbi27_sse2.c fec.h +- gcc $(CFLAGS) -msse2 -c -o $@ $< ++ ${CC} $(CFLAGS) -msse2 -c -o $@ $< + + viterbi29.o: viterbi29.c fec.h + +@@ -190,13 +188,13 @@ viterbi29_port.o: viterbi29_port.c fec.h + viterbi29_av.o: viterbi29_av.c fec.h + + viterbi29_mmx.o: viterbi29_mmx.c fec.h +- gcc $(CFLAGS) -mmmx -c -o $@ $< ++ ${CC} $(CFLAGS) -mmmx -c -o $@ $< + + viterbi29_sse.o: viterbi29_sse.c fec.h +- gcc $(CFLAGS) -msse -c -o $@ $< ++ ${CC} $(CFLAGS) -msse -c -o $@ $< + + viterbi29_sse2.o: viterbi29_sse2.c fec.h +- gcc $(CFLAGS) -msse2 -c -o $@ $< ++ ${CC} $(CFLAGS) -msse2 -c -o $@ $< + + viterbi39.o: viterbi39.c fec.h + +@@ -205,13 +203,13 @@ viterbi39_port.o: viterbi39_port.c fec.h + viterbi39_av.o: viterbi39_av.c fec.h + + viterbi39_mmx.o: viterbi39_mmx.c fec.h +- gcc $(CFLAGS) -mmmx -c -o $@ $< ++ ${CC} $(CFLAGS) -mmmx -c -o $@ $< + + viterbi39_sse.o: viterbi39_sse.c fec.h +- gcc $(CFLAGS) -msse -c -o $@ $< ++ ${CC} $(CFLAGS) -msse -c -o $@ $< + + viterbi39_sse2.o: viterbi39_sse2.c fec.h +- gcc $(CFLAGS) -msse2 -c -o $@ $< ++ ${CC} $(CFLAGS) -msse2 -c -o $@ $< + + viterbi615.o: viterbi615.c fec.h + +@@ -220,17 +218,15 @@ viterbi615_port.o: viterbi615_port.c fec + viterbi615_av.o: viterbi615_av.c fec.h + + viterbi615_mmx.o: viterbi615_mmx.c fec.h +- gcc $(CFLAGS) -mmmx -c -o $@ $< ++ ${CC} $(CFLAGS) -mmmx -c -o $@ $< + + viterbi615_sse.o: viterbi615_sse.c fec.h +- gcc $(CFLAGS) -msse -c -o $@ $< ++ ${CC} $(CFLAGS) -msse -c -o $@ $< + + viterbi615_sse2.o: viterbi615_sse2.c fec.h +- gcc $(CFLAGS) -msse2 -c -o $@ $< +- +-cpu_mode_x86.o: cpu_mode_x86.c fec.h ++ ${CC} $(CFLAGS) -msse2 -c -o $@ $< + +-cpu_mode_ppc.o: cpu_mode_ppc.c fec.h ++cpu_mode.o: cpu_mode.c fec.h + + + clean: diff --git a/comms/libfec/pkg-descr b/comms/libfec/pkg-descr new file mode 100644 index 000000000000..a6442bcadb6a --- /dev/null +++ b/comms/libfec/pkg-descr @@ -0,0 +1,20 @@ +This library package provides several forward error correction (FEC) decoders +and accelerated primitives useful in digital signal processing (DSP). +Except for the Reed-Solomon codecs, these functions take full advantage of +the MMX, SSE and SSE2 SIMD instruction sets on Intel/AMD IA-32 processors +and the Altivec/VMX/Velocity Engine SIMD instruction set on the +G4 and G5 PowerPC. +The library includes Viterbi decoders for the following convolutional codes: +rate 1/2 k=7 +rate 1/2 k=9 +rate 1/6 k=15 ("Cassini") +plus two Reed-Solomon encoder-decoders: +one optimized for the (255,223) CCSDS standard code +a general purpose encoder/decoder for arbitrary RS codes +and three low-level 16-bit DSP support routines: +signed dot product +peak detection +sum-of-squares (energy) computation +This library is licensed under the "lesser" GNU General Public License. + +WWW: http://www.ka9q.net/code/fec/ |