openwrt编译用于mt7688的mplayer

时间:2022-05-10 23:19:40

1.首先设置环境变量/etc/environment

openwrt编译用于mt7688的mplayer

2.把mplayer的源码拷贝于openwrt的package/mplayer/src下。

3.在openwrt 的package/mplayer/下新建一个Makefile

include $(TOPDIR)/rules.mk


# Name and release number of this package
PKG_NAME:=mplayer
PKG_RELEASE:=1


PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)


include $(INCLUDE_DIR)/package.mk


# Specify package information for this program.
# The variables defined here should be self explanatory.
# If you are running Kamikaze, delete the DESCRIPTION
# variable below and uncomment the Kamikaze define
# directive for the description below
define Package/mplayer
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=mplayer with wma fixed-point decoder
  DEPENDS:=+libmad +libasound +libncurses +liblzo +zlib +libjpeg +librt +libpthread
endef




# Uncomment portion below for Kamikaze and delete DESCRIPTION variable above
define Package/mplayer/description
endef


 


# Specify what needs to be done to prepare for building the package.
# In our case, we need to copy the source files to the build directory.
# This is NOT the default.  The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef




define Package/mplayer/install
$(INSTALL_DIR) $(1)/bin
$(CP) $(BUILD_DIR)/alsa-lib-1.0.28/ipkg-install/usr/lib/libasound.so* $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mplayer $(1)/bin/
endef




# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,mplayer))

4.在mplayer/src下新建配置文件build-alsa.sh,然后运行脚本

#!/bin/sh
./configure --host-cc=gcc \
--cc=mipsel-openwrt-linux-gcc \
--target=mips-linux \
--enable-linux-devfs \
--disable-dvdread \
--enable-fbdev \
--enable-libwma \
\
--enable-mad \
--enable-pthreads \
--enable-jpeg \
--enable-liblzo \
--disable-ladspa \
\
--ranlib=arm-linux-ranlib \
--disable-mencoder \
--disable-liba52 \
--disable-live \
--disable-mp3lib \
--enable-alsa \
--disable-ossaudio \
--disable-libavcodec_a \
--disable-libavformat_a \
--disable-libpostproc_a \
--disable-bitmap-font \
--disable-ivtv \
--disable-tv \
--disable-tga \
--disable-pnm \
--disable-md5sum \
--disable-libmpeg2 \
--disable-w32threads \
--disable-win32dll \
--disable-win32waveout \
--disable-qtx \
--disable-xanim \
--disable-libmpeg2 \
--disable-radio-v4l2 \
--disable-radio-bsdbt848 \
--disable-tv-v4l1 \
--disable-tv-v4l2 \
--disable-tv-bsdbt848 \
--disable-tv-teletext \
--disable-pvr \
--disable-mp3lib \
--disable-liba52 \
--disable-libmpeg2 \
--disable-decoder=DECODER \
--disable-encoder=ENCODER \
--disable-parser=PARSER   \
--disable-demuxer=DEMUXER  \
--disable-muxer=MUXER \
--with-extraincdir=/home/kevin/widora3/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include \
--with-extralibdir=/home/kevin/widora3/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib

5.为了防止一会编译的时候再configure,所有打开configure在开头加:

return 0

6.完成,可以编译了,编译过程中缺少什么需要在openwrt中make menuconfig 添加库。