Skip to content

Commit

Permalink
apps: add lame Makefile & CMakeLists.txt
Browse files Browse the repository at this point in the history
Signed-off-by: shizhenghui <[email protected]>
  • Loading branch information
shizhenghui authored and jerpelea committed Aug 22, 2024
1 parent ab67cb1 commit 309f42e
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 0 deletions.
1 change: 1 addition & 0 deletions audioutils/lame/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lame
26 changes: 26 additions & 0 deletions audioutils/lame/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ##############################################################################
# apps/audioutils/lame/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_AUDIOUTILS_LAME)

# call origin build system to generate libmp3lame
nuttx_call_apps_makefile(TARGET lame TARGET_BIN libmp3lame.a)

endif()
8 changes: 8 additions & 0 deletions audioutils/lame/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config AUDIOUTILS_LAME
bool "Enable LAME MP3 Encoder"
default n
23 changes: 23 additions & 0 deletions audioutils/lame/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
############################################################################
# apps/audioutils/lame/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

ifneq ($(CONFIG_AUDIOUTILS_LAME),)
CONFIGURED_APPS += $(APPDIR)/audioutils/lame
endif
105 changes: 105 additions & 0 deletions audioutils/lame/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
############################################################################
# apps/audioutils/lame/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

# Download lame if no lame/configure found
lame-svn:
$(Q) echo "svn checkout lame ..."
$(Q) svn checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame

ifeq ($(wildcard lame/configure),)
context:: lame-svn
distclean::
$(call DELDIR, lame)
endif

ifeq ($(DST_PATH),)
include $(APPDIR)/Make.defs
# configure in place
DST_PATH := lame
else
# configure out of tree
DST_PATH := $(realpath $(DST_PATH))
include $(DST_PATH)/Make.defs
BIN := $(DST_PATH)/libmp3lame.a
# enable Application.mk PREFIX
PREFIX := $(DST_PATH)$(DELIM)
endif

ifneq ($(CONFIG_ARCH),sim)
CFG_CMDS += --host=$(CONFIG_ARCH)
CFG_CMDS += --cross-prefix=$(CROSSDEV)
endif

SRC_PATH := lame

CFLAGS += -DHAVE_CONFIG_H -D'fast_log2=lame_fast_log2'
CFLAGS += $(INCDIR_PREFIX)$(DST_PATH) \
$(INCDIR_PREFIX)$(SRC_PATH)/include \
$(INCDIR_PREFIX)$(SRC_PATH)/libmp3lame
CFLAGS += -Wno-address -Wno-array-parameter \
-Wno-builtin-declaration-mismatch \
-Wno-incompatible-pointer-types \
-Wno-implicit-function-declaration -Wno-shadow \
-Wno-stringop-overflow -Wno-unused-variable \
-Wno-unused-but-set-variable \
-msse

CSRCS += $(SRC_PATH)/libmp3lame/bitstream.c \
$(SRC_PATH)/libmp3lame/encoder.c \
$(SRC_PATH)/libmp3lame/fft.c \
$(SRC_PATH)/libmp3lame/gain_analysis.c \
$(SRC_PATH)/libmp3lame/id3tag.c \
$(SRC_PATH)/libmp3lame/lame.c \
$(SRC_PATH)/libmp3lame/newmdct.c \
$(SRC_PATH)/libmp3lame/psymodel.c \
$(SRC_PATH)/libmp3lame/quantize.c \
$(SRC_PATH)/libmp3lame/vector/xmm_quantize_sub.c \
$(SRC_PATH)/libmp3lame/quantize_pvt.c \
$(SRC_PATH)/libmp3lame/set_get.c \
$(SRC_PATH)/libmp3lame/vbrquantize.c \
$(SRC_PATH)/libmp3lame/reservoir.c \
$(SRC_PATH)/libmp3lame/tables.c \
$(SRC_PATH)/libmp3lame/takehiro.c \
$(SRC_PATH)/libmp3lame/util.c \
$(SRC_PATH)/libmp3lame/VbrTag.c \
$(SRC_PATH)/libmp3lame/version.c \
$(SRC_PATH)/libmp3lame/presets.c

LAME_CONFIG_SCRIPT := $(CURDIR)$(DELIM)lame$(DELIM)configure

$(DST_PATH)/config.h:
$(Q)echo "lame configure... $(CONFIG_ARCH)"
$(Q)cd $(DST_PATH) && $(LAME_CONFIG_SCRIPT) \
--disable-cpml --disable-decoder --disable-efence \
--disable-frontend --disable-mp3x --disable-gtktest \
--disable-ipv6 --disable-rpath --enable-static \
$(CFG_CMDS)

context:: $(DST_PATH)/config.h

ifneq ($(PREFIX),)
@$(eval ALL_SRCS = $(CSRCS))
@$(foreach src,$(ALL_SRCS),$(shell mkdir -p $(PREFIX)$(dir $(src))))
endif

distclean::
$(Q)cd $(DST_PATH) && make distclean

include $(APPDIR)/Application.mk

0 comments on commit 309f42e

Please sign in to comment.