Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###########################################################
- #
- # ffmpeg
- #
- ###########################################################
- # You must replace "ffmpeg" and "FFMPEG" with the lower case name and
- # upper case name of your new package. Some places below will say
- # "Do not change this" - that does not include this global change,
- # which must always be done to ensure we have unique names.
- #
- # FFMPEG_VERSION, FFMPEG_SITE and FFMPEG_SOURCE define
- # the upstream location of the source code for the package.
- # FFMPEG_DIR is the directory which is created when the source
- # archive is unpacked.
- # FFMPEG_UNZIP is the command used to unzip the source.
- # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
- #
- # You should change all these variables to suit your package.
- #
- # Check http://svn.mplayerhq.hu/ffmpeg/trunk/
- # Take care when upgrading for multiple targets
- #
- # FFmpeg development has moved to a Git repository, and the SVN repository is no longer updated.
- # The SVN repository may be removed in a near future, so it's recommended to use the Git repository instead.
- #
- FFMPEG_SITE=http://www.ffmpeg.org/releases
- #FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk
- #FFMPEG_RELEASE_DATE=20080409
- FFMPEG_GIT=git://git.ffmpeg.org/ffmpeg.git
- FFMPEG_RELEASE_DATE=20110306
- FFMPEG_GIT_COMMIT=f4f4e12c0d4e86c4900481b7dca94d22e733c14a
- FFMPEG_VERSION=0.5.2
- ifdef FFMPEG_GIT
- FFMPEG_VERSION=0.git$(FFMPEG_RELEASE_DATE)
- else
- ifdef FFMPEG_SVN
- FFMPEG_VERSION=0.svn$(FFMPEG_RELEASE_DATE)
- endif
- endif
- FFMPEG_DIR=ffmpeg-$(FFMPEG_VERSION)
- FFMPEG_SOURCE=ffmpeg-$(FFMPEG_VERSION).tar.bz2
- FFMPEG_UNZIP=bzcat
- FFMPEG_MAINTAINER=Keith Garry Boyce <nslu2-linux@yahoogroups.com>
- FFMPEG_DESCRIPTION=FFmpeg is an audio/video conversion tool.
- FFMPEG_SECTION=tool
- FFMPEG_PRIORITY=optional
- FFMPEG_DEPENDS=
- FFMPEG_SUGGESTS=
- FFMPEG_CONFLICTS=
- #
- # FFMPEG_IPK_VERSION should be incremented when the ipk changes.
- #
- FFMPEG_IPK_VERSION=1
- #
- # FFMPEG_CONFFILES should be a list of user-editable files
- #FFMPEG_CONFFILES=/opt/etc/ffmpeg.conf /opt/etc/init.d/SXXffmpeg
- #
- ## FFMPEG_PATCHES should list any patches, in the the order in
- # which they should be applied to the source code.
- #
- FFMPEG_PATCHES=
- #ifeq ($(LIBC_STYLE), uclibc)
- #FFMPEG_PATCHES += $(FFMPEG_SOURCE_DIR)/disable-C99-math-funcs.patch
- #endif
- #
- # If the compilation of the package requires additional
- # compilation or linking flags, then list them here.
- #
- FFMPEG_CPPFLAGS=
- ifdef NO_BUILTIN_MATH
- FFMPEG_CPPFLAGS += -fno-builtin-cos -fno-builtin-sin -fno-builtin-lrint -fno-builtin-lrintf -fno-builtin-rint -fno-builtin-round -fno-builtin-roundf -fno-builtin-truncf
- FFMPEG_PATCHES += $(FFMPEG_SOURCE_DIR)/powf-to-pow.patch
- endif
- ifeq ($(OPTWARE_TARGET), $(filter mbwe-bluering, $(OPTWARE_TARGET)))
- ### "Unknown pseudo-op: .eabi_attribute" issue
- FFMPEG_PATCHES += $(FFMPEG_SOURCE_DIR)/armv6-oabi-optimizations.patch
- endif
- FFMPEG_LDFLAGS=
- FFMPEG_CONFIG_OPTS ?=
- #
- # FFMPEG_BUILD_DIR is the directory in which the build is done.
- # FFMPEG_SOURCE_DIR is the directory which holds all the
- # patches and ipkg control files.
- # FFMPEG_IPK_DIR is the directory in which the ipk is built.
- # FFMPEG_IPK is the name of the resulting ipk files.
- #
- # You should not change any of these variables.
- #
- FFMPEG_BUILD_DIR=$(BUILD_DIR)/ffmpeg
- FFMPEG_SOURCE_DIR=$(SOURCE_DIR)/ffmpeg
- FFMPEG_IPK_DIR=$(BUILD_DIR)/ffmpeg-$(FFMPEG_VERSION)-ipk
- FFMPEG_IPK=$(BUILD_DIR)/ffmpeg_$(FFMPEG_VERSION)-$(FFMPEG_IPK_VERSION)_$(TARGET_ARCH).ipk
- #
- # This is the dependency on the source code. If the source is missing,
- # then it will be fetched from the site using wget.
- #
- #$(DL_DIR)/$(FFMPEG_SOURCE):
- # $(WGET) -P $(DL_DIR) $(FFMPEG_SITE)/$(FFMPEG_SOURCE)
- $(DL_DIR)/$(FFMPEG_SOURCE):
- ifdef FFMPEG_GIT
- ( cd $(BUILD_DIR) ; \
- rm -rf $(FFMPEG_DIR) && \
- git clone $(FFMPEG_GIT) $(FFMPEG_DIR) && \
- cd $(FFMPEG_DIR) && \
- git checkout $(FFMPEG_GIT_COMMIT) && \
- cd .. && \
- tar -cjf $@ $(FFMPEG_DIR) --exclude .git --exclude .gitignore && \
- rm -rf $(FFMPEG_DIR) \
- ) || \
- $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
- else
- ifdef FFMPEG_SVN
- ( cd $(BUILD_DIR) ; \
- rm -rf $(FFMPEG_DIR) && \
- svn co -r '{$(FFMPEG_RELEASE_DATE)}' $(FFMPEG_SVN) $(FFMPEG_DIR) && \
- tar -cjf $@ $(FFMPEG_DIR) --exclude .svn && \
- rm -rf $(FFMPEG_DIR) \
- ) || \
- $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
- else
- $(WGET) -P $(@D) $(FFMPEG_SITE)/$(@F) || \
- $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
- endif
- endif
- #
- # The source code depends on it existing within the download directory.
- # This target will be called by the top level Makefile to download the
- # source code's archive (.tar.gz, .bz2, etc.)
- #
- ffmpeg-source: $(DL_DIR)/$(FFMPEG_SOURCE) $(FFMPEG_PATCHES)
- #
- # This target unpacks the source code in the build directory.
- # If the source archive is not .tar.gz or .tar.bz2, then you will need
- # to change the commands here. Patches to the source code are also
- # applied in this target as required.
- #
- # This target also configures the build within the build directory.
- # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
- # and NOT $(MAKE) below. Passing it to configure causes configure to
- # correctly BUILD the Makefile with the right paths, where passing it
- # to Make causes it to override the default search paths of the compiler.
- #
- # If the compilation of the package requires other packages to be staged
- ## first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
- #
- #
- FFMPEG_ARCH=$(strip \
- $(if $(filter armeb, $(TARGET_ARCH)), arm, \
- $(TARGET_ARCH)))
- # Snow is known to create build problems on ds101
- $(FFMPEG_BUILD_DIR)/.configured: $(DL_DIR)/$(FFMPEG_SOURCE) $(FFMPEG_PATCHES) make/ffmpeg.mk
- # $(MAKE) <bar>-stage <baz>-stage
- rm -rf $(BUILD_DIR)/$(FFMPEG_DIR) $(@D)
- $(FFMPEG_UNZIP) $(DL_DIR)/$(FFMPEG_SOURCE) | tar -C $(BUILD_DIR) -xvf -
- if test -n "$(FFMPEG_PATCHES)" ; \
- then cat $(FFMPEG_PATCHES) | \
- patch -d $(BUILD_DIR)/$(FFMPEG_DIR) -p0 ; \
- fi
- if test "$(BUILD_DIR)/$(FFMPEG_DIR)" != "$(@D)" ; \
- then mv $(BUILD_DIR)/$(FFMPEG_DIR) $(@D) ; \
- fi
- ifeq ($(LIBC_STYLE), uclibc)
- # disable C99 math functions
- for func in llrint lrint llrintf lrintf round roundf truncf; do \
- sed -i -e "s/^check_mathfunc $${func}$$/disable $${func}/" $(@D)/configure ; \
- done
- endif
- (cd $(@D); \
- $(TARGET_CONFIGURE_OPTS) \
- CPPFLAGS="$(STAGING_CPPFLAGS) $(FFMPEG_CPPFLAGS)" \
- LDFLAGS="$(STAGING_LDFLAGS) $(FFMPEG_LDFLAGS)" \
- ./configure \
- --enable-cross-compile \
- --cross-prefix=$(TARGET_CROSS) \
- --arch=$(FFMPEG_ARCH) \
- --target-os=linux \
- $(FFMPEG_CONFIG_OPTS) \
- --disable-encoder=snow \
- --disable-decoder=snow \
- --enable-shared \
- --disable-static \
- --enable-gpl \
- --enable-postproc \
- --prefix=/opt \
- )
- sed -i -e "/^#include \"libavutil\/avstring\.h\"/s/$$/\n#include \"libavutil\/libm\.h\"/" $(@D)/ffserver.c
- ifeq ($(LIBC_STYLE), uclibc)
- # No lrintf() support in uClibc 0.9.28
- sed -i -e 's/-D_ISOC9X_SOURCE\|-D_ISOC99_SOURCE//g' $(@D)/common.mak $(@D)/config.mak $(@D)/Makefile $(@D)/lib*/Makefile
- endif
- sed -i -e '/^OPTFLAGS/s| -O3| $(TARGET_CUSTOM_FLAGS) $(FFMPEG_CPPFLAGS) $$(OPTLEVEL)|' $(@D)/config.mak
- touch $@
- ffmpeg-unpack: $(FFMPEG_BUILD_DIR)/.configured
- #
- # This builds the actual binary.
- #
- $(FFMPEG_BUILD_DIR)/.built: $(FFMPEG_BUILD_DIR)/.configured
- rm -f $@
- ifeq ($(OPTWARE_TARGET), $(filter cs05q1armel cs05q3armel fsg3v4, $(OPTWARE_TARGET)))
- $(MAKE) -C $(@D) OPTLEVEL=-O2 ffmpeg.o
- endif
- $(MAKE) -C $(@D) OPTLEVEL=-O3
- touch $@
- #
- # This is the build convenience target.
- #
- ffmpeg: $(FFMPEG_BUILD_DIR)/.built
- #
- # If you are building a library, then you need to stage it too.
- #
- $(FFMPEG_BUILD_DIR)/.staged: $(FFMPEG_BUILD_DIR)/.built
- rm -f $@
- rm -rf $(STAGING_INCLUDE_DIR)/ffmpeg $(STAGING_INCLUDE_DIR)/postproc
- $(MAKE) -C $(@D) install \
- mandir=/opt/man \
- bindir=/opt/bin \
- libdir=/opt/lib \
- prefix=/opt \
- DESTDIR=$(STAGING_DIR)
- install -d $(STAGING_INCLUDE_DIR)/ffmpeg $(STAGING_INCLUDE_DIR)/postproc
- cp -p $(STAGING_INCLUDE_DIR)/libavutil/* \
- $(STAGING_INCLUDE_DIR)/libavformat/* \
- $(STAGING_INCLUDE_DIR)/ffmpeg/
- rm -f $(STAGING_INCLUDE_DIR)/ffmpeg/opt.h
- cp -p $(STAGING_INCLUDE_DIR)/libavcodec/* \
- $(STAGING_INCLUDE_DIR)/ffmpeg/
- cp -p $(STAGING_INCLUDE_DIR)/libpostproc/* \
- $(STAGING_INCLUDE_DIR)/postproc/
- sed -i -e 's|^prefix=.*|prefix=$(STAGING_PREFIX)|' \
- $(STAGING_LIB_DIR)/pkgconfig/libavcodec.pc \
- $(STAGING_LIB_DIR)/pkgconfig/libavformat.pc \
- $(STAGING_LIB_DIR)/pkgconfig/libavutil.pc \
- $(STAGING_LIB_DIR)/pkgconfig/libpostproc.pc
- touch $@
- ffmpeg-stage: $(FFMPEG_BUILD_DIR)/.staged
- #
- # This rule creates a control file for ipkg. It is no longer
- # necessary to create a seperate control file under sources/ffmpeg
- #
- $(FFMPEG_IPK_DIR)/CONTROL/control:
- @install -d $(@D)
- @rm -f $@
- @echo "Package: ffmpeg" >>$@
- @echo "Architecture: $(TARGET_ARCH)" >>$@
- @echo "Priority: $(FFMPEG_PRIORITY)" >>$@
- @echo "Section: $(FFMPEG_SECTION)" >>$@
- @echo "Version: $(FFMPEG_VERSION)-$(FFMPEG_IPK_VERSION)" >>$@
- @echo "Maintainer: $(FFMPEG_MAINTAINER)" >>$@
- @echo "Source: $(FFMPEG_SITE)/$(FFMPEG_SOURCE)" >>$@
- @echo "Description: $(FFMPEG_DESCRIPTION)" >>$@
- @echo "Depends: $(FFMPEG_DEPENDS)" >>$@
- @echo "Suggests: $(FFMPEG_SUGGESTS)" >>$@
- @echo "Conflicts: $(FFMPEG_CONFLICTS)" >>$@
- #
- # This builds the IPK file.
- #
- # Binaries should be installed into $(FFMPEG_IPK_DIR)/opt/sbin or $(FFMPEG_IPK_DIR)/opt/bin
- # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
- # Libraries and include files should be installed into $(FFMPEG_IPK_DIR)/opt/{lib,include}
- # Configuration files should be installed in $(FFMPEG_IPK_DIR)/opt/etc/ffmpeg/...
- # Documentation files should be installed in $(FFMPEG_IPK_DIR)/opt/doc/ffmpeg/...
- # Daemon startup scripts should be installed in $(FFMPEG_IPK_DIR)/opt/etc/init.d/S??ffmpeg
- #
- # You may need to patch your application to make it use these locations.
- #
- $(FFMPEG_IPK): $(FFMPEG_BUILD_DIR)/.built
- rm -rf $(FFMPEG_IPK_DIR) $(BUILD_DIR)/ffmpeg_*_$(TARGET_ARCH).ipk
- $(MAKE) -C $(FFMPEG_BUILD_DIR) mandir=/opt/man \
- bindir=/opt/bin libdir=/opt/lib \
- prefix=/opt DESTDIR=$(FFMPEG_IPK_DIR) \
- LDCONFIG='$$(warning ldconfig disabled when building package)' install
- $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/bin/ffmpeg
- $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/bin/ffserver
- $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/lib/*.so
- $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/lib/vhook/*.so
- $(MAKE) $(FFMPEG_IPK_DIR)/CONTROL/control
- cd $(BUILD_DIR); $(IPKG_BUILD) $(FFMPEG_IPK_DIR)
- #
- # This is called from the top level makefile to create the IPK file.
- #
- ffmpeg-ipk: $(FFMPEG_IPK)
- #
- # This is called from the top level makefile to clean all of the built files.
- #
- ffmpeg-clean:
- -$(MAKE) -C $(FFMPEG_BUILD_DIR) clean
- #
- # This is called from the top level makefile to clean all dynamically created
- # directories.
- #
- ffmpeg-dirclean:
- rm -rf $(BUILD_DIR)/$(FFMPEG_DIR) $(FFMPEG_BUILD_DIR) $(FFMPEG_IPK_DIR) $(FFMPEG_IPK)
- #
- # Some sanity check for the package.
- #
- ffmpeg-check: $(FFMPEG_IPK)
- perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement