From aa3e19f0eb24eb3d1978ea183b483f70a2a00e82 Mon Sep 17 00:00:00 2001 From: nico Date: Mon, 17 Oct 2005 23:46:05 +0000 Subject: [PATCH] add flac package (thanks to David Collet) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@2158 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- openwrt/package/Config.in | 1 + openwrt/package/Makefile | 1 + openwrt/package/flac/Config.in | 14 + openwrt/package/flac/Makefile | 60 ++++ openwrt/package/flac/ipkg/libflac.control | 8 + openwrt/package/flac/patches/no_encoder.patch | 280 ++++++++++++++++++ 6 files changed, 364 insertions(+) create mode 100644 openwrt/package/flac/Config.in create mode 100644 openwrt/package/flac/Makefile create mode 100644 openwrt/package/flac/ipkg/libflac.control create mode 100644 openwrt/package/flac/patches/no_encoder.patch diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in index c52697a26..e53606967 100644 --- a/openwrt/package/Config.in +++ b/openwrt/package/Config.in @@ -146,6 +146,7 @@ source "package/libdnet/Config.in" source "package/libelf/Config.in" source "package/libevent/Config.in" source "package/expat/Config.in" # libexpat +source "package/flac/Config.in" # libflac source "package/freetype/Config.in" # libfreetype source "package/libgcrypt/Config.in" source "package/libgd/Config.in" diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 62ed32602..f01215252 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -37,6 +37,7 @@ package-$(BR2_PACKAGE_EBTABLES) += ebtables package-$(BR2_PACKAGE_ETHER_WAKE) += ether-wake package-$(BR2_COMPILE_EXPAT) += expat package-$(BR2_PACKAGE_EZIPUPDATE) += ez-ipupdate +package-$(BR2_COMPILE_FLAC) += flac package-$(BR2_PACKAGE_FPING) += fping package-$(BR2_PACKAGE_FPROBE) += fprobe package-$(BR2_PACKAGE_FPROBE_ULOG) += fprobe-ulog diff --git a/openwrt/package/flac/Config.in b/openwrt/package/flac/Config.in new file mode 100644 index 000000000..73cdd86f5 --- /dev/null +++ b/openwrt/package/flac/Config.in @@ -0,0 +1,14 @@ +config BR2_COMPILE_FLAC + bool + default n + depends BR2_PACKAGE_LIBFLAC + +config BR2_PACKAGE_LIBFLAC + tristate "libflac - Free Lossless Audio Codec library" + default m if CONFIG_DEVEL + select BR2_COMPILE_FLAC + help + Free Lossless Audio Codec library + + http://flac.sourceforge.net/ + diff --git a/openwrt/package/flac/Makefile b/openwrt/package/flac/Makefile new file mode 100644 index 000000000..9baa0da85 --- /dev/null +++ b/openwrt/package/flac/Makefile @@ -0,0 +1,60 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=flac +PKG_VERSION:=1.1.2 +PKG_RELEASE:=1 +PKG_MD5SUM:=2bfc127cdda02834d0491ab531a20960 + +PKG_SOURCE_URL:=@SF/flac +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(TOPDIR)/package/rules.mk + +$(eval $(call PKG_template,LIBFLAC,libflac,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +$(PKG_BUILD_DIR)/.configured: + touch $@ + +$(PKG_BUILD_DIR)/.built: + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.lite \ + $(TARGET_CONFIGURE_OPTS) \ + libFLAC + touch $@ + +$(IPKG_LIBFLAC): + install -m0755 -d $(IDIR_LIBFLAC)/usr/lib + cp -fpR $(PKG_BUILD_DIR)/obj/release/lib/libFLAC.so $(IDIR_LIBFLAC)/usr/lib/ + $(RSTRIP) $(IDIR_LIBFLAC) + $(IPKG_BUILD) $(IDIR_LIBFLAC) $(PACKAGE_DIR) + +$(STAGING_DIR)/usr/lib/libFLAC.so: $(PKG_BUILD_DIR)/.built + mkdir -p $(STAGING_DIR)/usr/include + cp -fpR $(PKG_BUILD_DIR)/include/FLAC $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + cp -fpR $(PKG_BUILD_DIR)/obj/release/lib/libFLAC.a $(STAGING_DIR)/usr/lib/ + cp -fpR $(PKG_BUILD_DIR)/obj/release/lib/libFLAC.so $(STAGING_DIR)/usr/lib/ + touch $@ + +install-dev: $(STAGING_DIR)/usr/lib/libFLAC.so + +uninstall-dev: + rm -rf \ + $(STAGING_DIR)/usr/include/FLAC \ + $(STAGING_DIR)/usr/lib/libFLAC.a \ + $(STAGING_DIR)/usr/lib/libFLAC.so \ + +compile: install-dev +clean: uninstall-dev + +mostlyclean: + -$(MAKE) -C $(PKG_BUILD_DIR) clean + rm -f $(PKG_BUILD_DIR)/.built + diff --git a/openwrt/package/flac/ipkg/libflac.control b/openwrt/package/flac/ipkg/libflac.control new file mode 100644 index 000000000..e7b5cb71b --- /dev/null +++ b/openwrt/package/flac/ipkg/libflac.control @@ -0,0 +1,8 @@ +Package: libflac +Priority: optional +Section: libs +Version: [TBDL] +Architecture: [TBDL] +Maintainer: OpenWrt Developers Team , David Collett +Source: buildroot internal +Description: Free Lossless Audio Codec library diff --git a/openwrt/package/flac/patches/no_encoder.patch b/openwrt/package/flac/patches/no_encoder.patch new file mode 100644 index 000000000..64666e803 --- /dev/null +++ b/openwrt/package/flac/patches/no_encoder.patch @@ -0,0 +1,280 @@ +diff -ru flac-1.1.2.OLD/build/lib.mk flac-1.1.2.NEW/build/lib.mk +--- flac-1.1.2.OLD/build/lib.mk 2005-01-25 15:10:47.000000000 +1100 ++++ flac-1.1.2.NEW/build/lib.mk 2005-10-16 10:10:43.000000000 +1000 +@@ -58,7 +58,7 @@ + + debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) + valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -Wall -W -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) +-release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) ++release : CFLAGS = -Os -pipe -mips32 -mtune=mips32 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -Wall -W -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) + + LFLAGS = -L$(LIBPATH) + +diff -ru flac-1.1.2.OLD/src/libFLAC/lpc.c flac-1.1.2.NEW/src/libFLAC/lpc.c +--- flac-1.1.2.OLD/src/libFLAC/lpc.c 2005-01-26 15:31:36.000000000 +1100 ++++ flac-1.1.2.NEW/src/libFLAC/lpc.c 2005-10-16 10:44:58.000000000 +1000 +@@ -293,6 +293,209 @@ + + void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) + { ++ register const FLAC__int32 *qlp0 = &qlp_coeff[(order-1)]; ++ register FLAC__int32 sum; ++ register const FLAC__int32 *history, *qlp; ++ ++ history = &data[(-order)]; ++ ++ switch (order) { ++ case 12: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ + (qlp0[-6] * history[6]) ++ + (qlp0[-7] * history[7]) ++ + (qlp0[-8] * history[8]) ++ + (qlp0[-9] * history[9]) ++ + (qlp0[-10] * history[10]) ++ + (qlp0[-11] * history[11]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 11: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ + (qlp0[-6] * history[6]) ++ + (qlp0[-7] * history[7]) ++ + (qlp0[-8] * history[8]) ++ + (qlp0[-9] * history[9]) ++ + (qlp0[-10] * history[10]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 10: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ + (qlp0[-6] * history[6]) ++ + (qlp0[-7] * history[7]) ++ + (qlp0[-8] * history[8]) ++ + (qlp0[-9] * history[9]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 9: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ + (qlp0[-6] * history[6]) ++ + (qlp0[-7] * history[7]) ++ + (qlp0[-8] * history[8]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 8: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ + (qlp0[-6] * history[6]) ++ + (qlp0[-7] * history[7]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 7: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ + (qlp0[-6] * history[6]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 6: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ + (qlp0[-5] * history[5]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 5: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ + (qlp0[-4] * history[4]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 4: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ + (qlp0[-3] * history[3]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 3: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ + (qlp0[-2] * history[2]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 2: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * history[0]) ++ + (qlp0[-1] * history[1]) ++ ; ++ ++history; ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ case 1: ++ for( ; data_len != 0; --data_len) { ++ sum = (qlp0[0] * (*(history++))); ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ default: ++ { ++ /* handle everything else: (order > 12) ++ * with Duff's Device to reduce jumps */ ++ const unsigned n0 = (order + 7)/8; ++ const int tmp = 0 - order - 1; ++ register const FLAC__int32 *qlpd = &qlp_coeff[order]; ++ for( ; data_len != 0; --data_len) { ++ register unsigned n = n0; ++ sum = 0; ++ qlp = qlpd; ++ history = &data[tmp]; ++ ++ switch(order%8) { ++ case 0: do { ++ sum += (*(--qlp)) * (*(++history)); ++ case 7: sum += (*(--qlp)) * (*(++history)); ++ case 6: sum += (*(--qlp)) * (*(++history)); ++ case 5: sum += (*(--qlp)) * (*(++history)); ++ case 4: sum += (*(--qlp)) * (*(++history)); ++ case 3: sum += (*(--qlp)) * (*(++history)); ++ case 2: sum += (*(--qlp)) * (*(++history)); ++ case 1: sum += (*(--qlp)) * (*(++history)); ++ } while (--n); ++ } ++ ++ *(data++) = *(residual++) + (sum >> lp_quantization); ++ } ++ return; ++ } ++ } ++} ++ ++#if 0 ++void FLAC__lpc_restore_signal_orig(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) ++{ + #ifdef FLAC__OVERFLOW_DETECT + FLAC__int64 sumo; + #endif +@@ -339,6 +542,7 @@ + } + */ + } ++#endif /* 0 */ + + void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) + { +diff -ru flac-1.1.2.OLD/src/libFLAC/Makefile.lite flac-1.1.2.NEW/src/libFLAC/Makefile.lite +--- flac-1.1.2.OLD/src/libFLAC/Makefile.lite 2005-01-27 11:08:35.000000000 +1100 ++++ flac-1.1.2.NEW/src/libFLAC/Makefile.lite 2005-10-16 10:13:29.000000000 +1000 +@@ -41,7 +41,7 @@ + ifeq ($(SOLARIS_BUILD),yes) + DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA + else +-DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM -DFLAC__ALIGN_MALLOC_DATA ++DEFINES = -DFLAC__CPU_UNKNOWN -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA -DFLAC__INTEGER_ONLY_LIBRARY + endif + endif + INCLUDES = -I./include -I$(topdir)/include +@@ -50,14 +50,6 @@ + ifeq ($(DARWIN_BUILD),yes) + SRCS_S = \ + ppc/as/lpc_asm.s +-else +-ifeq ($(SOLARIS_BUILD),yes) +-else +-SRCS_NASM = \ +- ia32/cpu_asm.nasm \ +- ia32/fixed_asm.nasm \ +- ia32/lpc_asm.nasm +-endif + endif + + SRCS_C = \ +@@ -66,7 +58,6 @@ + cpu.c \ + crc.c \ + file_decoder.c \ +- file_encoder.c \ + fixed.c \ + float.c \ + format.c \ +@@ -76,10 +67,7 @@ + metadata_iterators.c \ + metadata_object.c \ + seekable_stream_decoder.c \ +- seekable_stream_encoder.c \ +- stream_decoder.c \ +- stream_encoder.c \ +- stream_encoder_framing.c ++ stream_decoder.c + + include $(topdir)/build/lib.mk + -- 2.20.1