Advertisement
alllexx

Untitled

Mar 7th, 2011
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 11.09 KB | None | 0 0
  1. ###########################################################
  2. #
  3. # ffmpeg
  4. #
  5. ###########################################################
  6.  
  7. # You must replace "ffmpeg" and "FFMPEG" with the lower case name and
  8. # upper case name of your new package.  Some places below will say
  9. # "Do not change this" - that does not include this global change,
  10. # which must always be done to ensure we have unique names.
  11.  
  12. #
  13. # FFMPEG_VERSION, FFMPEG_SITE and FFMPEG_SOURCE define
  14. # the upstream location of the source code for the package.
  15. # FFMPEG_DIR is the directory which is created when the source
  16. # archive is unpacked.
  17. # FFMPEG_UNZIP is the command used to unzip the source.
  18. # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
  19. #
  20. # You should change all these variables to suit your package.
  21. #
  22. # Check http://svn.mplayerhq.hu/ffmpeg/trunk/
  23. # Take care when upgrading for multiple targets
  24. #
  25. # FFmpeg development has moved to a Git repository, and the SVN repository is no longer updated.
  26. # The SVN repository may be removed in a near future, so it's recommended to use the Git repository instead.
  27. #
  28.  
  29. FFMPEG_SITE=http://www.ffmpeg.org/releases
  30. #FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk
  31. #FFMPEG_RELEASE_DATE=20080409
  32. FFMPEG_GIT=git://git.ffmpeg.org/ffmpeg.git
  33. FFMPEG_RELEASE_DATE=20110306
  34. FFMPEG_GIT_COMMIT=f4f4e12c0d4e86c4900481b7dca94d22e733c14a
  35. FFMPEG_VERSION=0.5.2
  36. ifdef FFMPEG_GIT
  37. FFMPEG_VERSION=0.git$(FFMPEG_RELEASE_DATE)
  38. else
  39. ifdef FFMPEG_SVN
  40. FFMPEG_VERSION=0.svn$(FFMPEG_RELEASE_DATE)
  41. endif
  42. endif
  43. FFMPEG_DIR=ffmpeg-$(FFMPEG_VERSION)
  44. FFMPEG_SOURCE=ffmpeg-$(FFMPEG_VERSION).tar.bz2
  45. FFMPEG_UNZIP=bzcat
  46. FFMPEG_MAINTAINER=Keith Garry Boyce <nslu2-linux@yahoogroups.com>
  47. FFMPEG_DESCRIPTION=FFmpeg is an audio/video conversion tool.
  48. FFMPEG_SECTION=tool
  49. FFMPEG_PRIORITY=optional
  50. FFMPEG_DEPENDS=
  51. FFMPEG_SUGGESTS=
  52. FFMPEG_CONFLICTS=
  53.  
  54. #
  55. # FFMPEG_IPK_VERSION should be incremented when the ipk changes.
  56. #
  57. FFMPEG_IPK_VERSION=1
  58.  
  59. #
  60. # FFMPEG_CONFFILES should be a list of user-editable files
  61. #FFMPEG_CONFFILES=/opt/etc/ffmpeg.conf /opt/etc/init.d/SXXffmpeg
  62.  
  63. #
  64. ## FFMPEG_PATCHES should list any patches, in the the order in
  65. # which they should be applied to the source code.
  66. #
  67. FFMPEG_PATCHES=
  68. #ifeq ($(LIBC_STYLE), uclibc)
  69. #FFMPEG_PATCHES += $(FFMPEG_SOURCE_DIR)/disable-C99-math-funcs.patch
  70. #endif
  71.  
  72. #
  73. # If the compilation of the package requires additional
  74. # compilation or linking flags, then list them here.
  75. #
  76. FFMPEG_CPPFLAGS=
  77. ifdef NO_BUILTIN_MATH
  78. 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
  79. FFMPEG_PATCHES += $(FFMPEG_SOURCE_DIR)/powf-to-pow.patch
  80. endif
  81. ifeq ($(OPTWARE_TARGET), $(filter mbwe-bluering, $(OPTWARE_TARGET)))
  82. ### "Unknown pseudo-op: .eabi_attribute" issue
  83. FFMPEG_PATCHES += $(FFMPEG_SOURCE_DIR)/armv6-oabi-optimizations.patch
  84. endif
  85. FFMPEG_LDFLAGS=
  86.  
  87. FFMPEG_CONFIG_OPTS ?=
  88.  
  89. #
  90. # FFMPEG_BUILD_DIR is the directory in which the build is done.
  91. # FFMPEG_SOURCE_DIR is the directory which holds all the
  92. # patches and ipkg control files.
  93. # FFMPEG_IPK_DIR is the directory in which the ipk is built.
  94. # FFMPEG_IPK is the name of the resulting ipk files.
  95. #
  96. # You should not change any of these variables.
  97. #
  98. FFMPEG_BUILD_DIR=$(BUILD_DIR)/ffmpeg
  99. FFMPEG_SOURCE_DIR=$(SOURCE_DIR)/ffmpeg
  100. FFMPEG_IPK_DIR=$(BUILD_DIR)/ffmpeg-$(FFMPEG_VERSION)-ipk
  101. FFMPEG_IPK=$(BUILD_DIR)/ffmpeg_$(FFMPEG_VERSION)-$(FFMPEG_IPK_VERSION)_$(TARGET_ARCH).ipk
  102.  
  103. #
  104. # This is the dependency on the source code.  If the source is missing,
  105. # then it will be fetched from the site using wget.
  106. #
  107. #$(DL_DIR)/$(FFMPEG_SOURCE):
  108. #   $(WGET) -P $(DL_DIR) $(FFMPEG_SITE)/$(FFMPEG_SOURCE)
  109.  
  110. $(DL_DIR)/$(FFMPEG_SOURCE):
  111. ifdef FFMPEG_GIT
  112.     ( cd $(BUILD_DIR) ; \
  113.         rm -rf $(FFMPEG_DIR) && \
  114.         git clone $(FFMPEG_GIT) $(FFMPEG_DIR) && \
  115.         cd $(FFMPEG_DIR) && \
  116.         git checkout $(FFMPEG_GIT_COMMIT) && \
  117.         cd .. && \
  118.         tar -cjf $@ $(FFMPEG_DIR) --exclude .git --exclude .gitignore && \
  119.         rm -rf $(FFMPEG_DIR) \
  120.     ) || \
  121.     $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
  122. else
  123. ifdef FFMPEG_SVN
  124.     ( cd $(BUILD_DIR) ; \
  125.         rm -rf $(FFMPEG_DIR) && \
  126.         svn co -r '{$(FFMPEG_RELEASE_DATE)}' $(FFMPEG_SVN) $(FFMPEG_DIR) && \
  127.         tar -cjf $@ $(FFMPEG_DIR) --exclude .svn && \
  128.         rm -rf $(FFMPEG_DIR) \
  129.     ) || \
  130.     $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
  131. else
  132.     $(WGET) -P $(@D) $(FFMPEG_SITE)/$(@F) || \
  133.     $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
  134. endif
  135. endif
  136.  
  137.  
  138. #
  139. # The source code depends on it existing within the download directory.
  140. # This target will be called by the top level Makefile to download the
  141. # source code's archive (.tar.gz, .bz2, etc.)
  142. #
  143. ffmpeg-source: $(DL_DIR)/$(FFMPEG_SOURCE) $(FFMPEG_PATCHES)
  144.  
  145. #
  146. # This target unpacks the source code in the build directory.
  147. # If the source archive is not .tar.gz or .tar.bz2, then you will need
  148. # to change the commands here.  Patches to the source code are also
  149. # applied in this target as required.
  150. #
  151. # This target also configures the build within the build directory.
  152. # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
  153. # and NOT $(MAKE) below.  Passing it to configure causes configure to
  154. # correctly BUILD the Makefile with the right paths, where passing it
  155. # to Make causes it to override the default search paths of the compiler.
  156. #
  157. # If the compilation of the package requires other packages to be staged
  158. ## first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
  159. #
  160. #
  161. FFMPEG_ARCH=$(strip \
  162.     $(if $(filter armeb, $(TARGET_ARCH)), arm, \
  163.     $(TARGET_ARCH)))
  164.  
  165. # Snow is known to create build problems on ds101
  166.  
  167. $(FFMPEG_BUILD_DIR)/.configured: $(DL_DIR)/$(FFMPEG_SOURCE) $(FFMPEG_PATCHES) make/ffmpeg.mk
  168. #   $(MAKE) <bar>-stage <baz>-stage
  169.     rm -rf $(BUILD_DIR)/$(FFMPEG_DIR) $(@D)
  170.     $(FFMPEG_UNZIP) $(DL_DIR)/$(FFMPEG_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  171.     if test -n "$(FFMPEG_PATCHES)" ; \
  172.         then cat $(FFMPEG_PATCHES) | \
  173.         patch -d $(BUILD_DIR)/$(FFMPEG_DIR) -p0 ; \
  174.     fi
  175.     if test "$(BUILD_DIR)/$(FFMPEG_DIR)" != "$(@D)" ; \
  176.         then mv $(BUILD_DIR)/$(FFMPEG_DIR) $(@D) ; \
  177.     fi
  178. ifeq ($(LIBC_STYLE), uclibc)
  179. #   disable C99 math functions
  180.     for func in llrint lrint llrintf lrintf round roundf truncf; do \
  181.         sed -i -e "s/^check_mathfunc $${func}$$/disable $${func}/" $(@D)/configure ; \
  182.     done
  183. endif
  184.     (cd $(@D); \
  185.         $(TARGET_CONFIGURE_OPTS) \
  186.         CPPFLAGS="$(STAGING_CPPFLAGS) $(FFMPEG_CPPFLAGS)" \
  187.         LDFLAGS="$(STAGING_LDFLAGS) $(FFMPEG_LDFLAGS)" \
  188.         ./configure \
  189.         --enable-cross-compile \
  190.         --cross-prefix=$(TARGET_CROSS) \
  191.         --arch=$(FFMPEG_ARCH) \
  192.         --target-os=linux \
  193.         $(FFMPEG_CONFIG_OPTS) \
  194.         --disable-encoder=snow \
  195.         --disable-decoder=snow \
  196.         --enable-shared \
  197.         --disable-static \
  198.         --enable-gpl \
  199.         --enable-postproc \
  200.         --prefix=/opt \
  201.     )
  202.     sed -i -e "/^#include \"libavutil\/avstring\.h\"/s/$$/\n#include \"libavutil\/libm\.h\"/" $(@D)/ffserver.c
  203. ifeq ($(LIBC_STYLE), uclibc)
  204. #   No lrintf() support in uClibc 0.9.28
  205.     sed -i -e 's/-D_ISOC9X_SOURCE\|-D_ISOC99_SOURCE//g' $(@D)/common.mak $(@D)/config.mak $(@D)/Makefile $(@D)/lib*/Makefile
  206. endif
  207.     sed -i -e '/^OPTFLAGS/s| -O3| $(TARGET_CUSTOM_FLAGS) $(FFMPEG_CPPFLAGS) $$(OPTLEVEL)|' $(@D)/config.mak
  208.     touch $@
  209.  
  210. ffmpeg-unpack: $(FFMPEG_BUILD_DIR)/.configured
  211.  
  212. #
  213. # This builds the actual binary.
  214. #
  215. $(FFMPEG_BUILD_DIR)/.built: $(FFMPEG_BUILD_DIR)/.configured
  216.     rm -f $@
  217. ifeq ($(OPTWARE_TARGET), $(filter cs05q1armel cs05q3armel fsg3v4, $(OPTWARE_TARGET)))
  218.     $(MAKE) -C $(@D) OPTLEVEL=-O2 ffmpeg.o
  219. endif
  220.     $(MAKE) -C $(@D) OPTLEVEL=-O3
  221.     touch $@
  222.  
  223. #
  224. # This is the build convenience target.
  225. #
  226. ffmpeg: $(FFMPEG_BUILD_DIR)/.built
  227.  
  228. #
  229. # If you are building a library, then you need to stage it too.
  230. #
  231. $(FFMPEG_BUILD_DIR)/.staged: $(FFMPEG_BUILD_DIR)/.built
  232.     rm -f $@
  233.     rm -rf $(STAGING_INCLUDE_DIR)/ffmpeg $(STAGING_INCLUDE_DIR)/postproc
  234.     $(MAKE) -C $(@D) install \
  235.         mandir=/opt/man \
  236.         bindir=/opt/bin \
  237.         libdir=/opt/lib \
  238.         prefix=/opt \
  239.         DESTDIR=$(STAGING_DIR)
  240.     install -d $(STAGING_INCLUDE_DIR)/ffmpeg $(STAGING_INCLUDE_DIR)/postproc
  241.     cp -p   $(STAGING_INCLUDE_DIR)/libavutil/* \
  242.         $(STAGING_INCLUDE_DIR)/libavformat/* \
  243.         $(STAGING_INCLUDE_DIR)/ffmpeg/
  244.     rm -f $(STAGING_INCLUDE_DIR)/ffmpeg/opt.h
  245.     cp -p   $(STAGING_INCLUDE_DIR)/libavcodec/* \
  246.         $(STAGING_INCLUDE_DIR)/ffmpeg/
  247.     cp -p   $(STAGING_INCLUDE_DIR)/libpostproc/* \
  248.         $(STAGING_INCLUDE_DIR)/postproc/
  249.     sed -i -e 's|^prefix=.*|prefix=$(STAGING_PREFIX)|' \
  250.         $(STAGING_LIB_DIR)/pkgconfig/libavcodec.pc \
  251.         $(STAGING_LIB_DIR)/pkgconfig/libavformat.pc \
  252.         $(STAGING_LIB_DIR)/pkgconfig/libavutil.pc \
  253.         $(STAGING_LIB_DIR)/pkgconfig/libpostproc.pc
  254.     touch $@
  255.  
  256. ffmpeg-stage: $(FFMPEG_BUILD_DIR)/.staged
  257.  
  258. #
  259. # This rule creates a control file for ipkg.  It is no longer
  260. # necessary to create a seperate control file under sources/ffmpeg
  261. #
  262. $(FFMPEG_IPK_DIR)/CONTROL/control:
  263.     @install -d $(@D)
  264.     @rm -f $@
  265.     @echo "Package: ffmpeg" >>$@
  266.     @echo "Architecture: $(TARGET_ARCH)" >>$@
  267.     @echo "Priority: $(FFMPEG_PRIORITY)" >>$@
  268.     @echo "Section: $(FFMPEG_SECTION)" >>$@
  269.     @echo "Version: $(FFMPEG_VERSION)-$(FFMPEG_IPK_VERSION)" >>$@
  270.     @echo "Maintainer: $(FFMPEG_MAINTAINER)" >>$@
  271.     @echo "Source: $(FFMPEG_SITE)/$(FFMPEG_SOURCE)" >>$@
  272.     @echo "Description: $(FFMPEG_DESCRIPTION)" >>$@
  273.     @echo "Depends: $(FFMPEG_DEPENDS)" >>$@
  274.     @echo "Suggests: $(FFMPEG_SUGGESTS)" >>$@
  275.     @echo "Conflicts: $(FFMPEG_CONFLICTS)" >>$@
  276.  
  277. #
  278. # This builds the IPK file.
  279. #
  280. # Binaries should be installed into $(FFMPEG_IPK_DIR)/opt/sbin or $(FFMPEG_IPK_DIR)/opt/bin
  281. # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
  282. # Libraries and include files should be installed into $(FFMPEG_IPK_DIR)/opt/{lib,include}
  283. # Configuration files should be installed in $(FFMPEG_IPK_DIR)/opt/etc/ffmpeg/...
  284. # Documentation files should be installed in $(FFMPEG_IPK_DIR)/opt/doc/ffmpeg/...
  285. # Daemon startup scripts should be installed in $(FFMPEG_IPK_DIR)/opt/etc/init.d/S??ffmpeg
  286. #
  287. # You may need to patch your application to make it use these locations.
  288. #
  289. $(FFMPEG_IPK): $(FFMPEG_BUILD_DIR)/.built
  290.     rm -rf $(FFMPEG_IPK_DIR) $(BUILD_DIR)/ffmpeg_*_$(TARGET_ARCH).ipk
  291.     $(MAKE) -C $(FFMPEG_BUILD_DIR) mandir=/opt/man \
  292.         bindir=/opt/bin libdir=/opt/lib \
  293.         prefix=/opt DESTDIR=$(FFMPEG_IPK_DIR) \
  294.         LDCONFIG='$$(warning ldconfig disabled when building package)' install
  295.     $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/bin/ffmpeg
  296.     $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/bin/ffserver
  297.     $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/lib/*.so
  298.     $(TARGET_STRIP) $(FFMPEG_IPK_DIR)/opt/lib/vhook/*.so
  299.     $(MAKE) $(FFMPEG_IPK_DIR)/CONTROL/control
  300.     cd $(BUILD_DIR); $(IPKG_BUILD) $(FFMPEG_IPK_DIR)
  301.  
  302. #
  303. # This is called from the top level makefile to create the IPK file.
  304. #
  305. ffmpeg-ipk: $(FFMPEG_IPK)
  306.  
  307. #
  308. # This is called from the top level makefile to clean all of the built files.
  309. #
  310. ffmpeg-clean:
  311.     -$(MAKE) -C $(FFMPEG_BUILD_DIR) clean
  312.  
  313. #
  314. # This is called from the top level makefile to clean all dynamically created
  315. # directories.
  316. #
  317. ffmpeg-dirclean:
  318.     rm -rf $(BUILD_DIR)/$(FFMPEG_DIR) $(FFMPEG_BUILD_DIR) $(FFMPEG_IPK_DIR) $(FFMPEG_IPK)
  319.  
  320. #
  321. # Some sanity check for the package.
  322. #
  323. ffmpeg-check: $(FFMPEG_IPK)
  324.     perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement