You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

800 lines
19 KiB

  1. #
  2. # Copyright (C) 2017-2019 Ian Leonard <antonlacon@gmail.com>
  3. # Copyright (C) 2018 Ted Hess <thess@kitschensync.net>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=ffmpeg
  10. PKG_VERSION:=3.4.6
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_SOURCE_URL:=https://ffmpeg.org/releases/
  14. PKG_HASH:=3572279cb139d9e39dcfbc23edf438ff5311ec3fc5d0dcb3558e49591e5cb83e
  15. PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
  16. Ian Leonard <antonlacon@gmail.com>
  17. PKG_LICENSE:=LGPL-2.1-or-later GPL-2.0-or-later LGPL-3
  18. PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
  19. PKG_CPE_ID:=cpe:/a:ffmpeg:ffmpeg
  20. FFMPEG_CUSTOM_ENCODERS:= \
  21. ac3 \
  22. jpegls \
  23. mpeg1video \
  24. mpeg2video \
  25. mpeg4 \
  26. pcm_s16be \
  27. pcm_s16le \
  28. png \
  29. vorbis \
  30. zlib \
  31. FFMPEG_CUSTOM_DECODERS:= \
  32. aac \
  33. ac3 \
  34. alac \
  35. amrnb \
  36. amrwb \
  37. ape \
  38. atrac3 \
  39. flac \
  40. gif \
  41. h264 \
  42. hevc \
  43. jpegls \
  44. mp2 \
  45. mp3 \
  46. mpeg1video \
  47. mpeg2video \
  48. mpeg4 \
  49. mpegvideo \
  50. mpc7 \
  51. mpc8 \
  52. pcm_s16be \
  53. pcm_s16le \
  54. png \
  55. vc1 \
  56. vorbis \
  57. wavpack \
  58. wmav1 \
  59. wmav2 \
  60. zlib \
  61. FFMPEG_CUSTOM_MUXERS:= \
  62. ac3 \
  63. ffm \
  64. h264 \
  65. hevc \
  66. mp3 \
  67. mp4 \
  68. mpeg1video \
  69. mpeg2video \
  70. mpegts \
  71. ogg \
  72. rtp \
  73. FFMPEG_CUSTOM_DEMUXERS:= \
  74. aac \
  75. ac3 \
  76. amr \
  77. ape \
  78. avi \
  79. flac \
  80. ffm \
  81. h264 \
  82. hevc \
  83. matroska \
  84. mov \
  85. mp3 \
  86. mpegps \
  87. mpegts \
  88. mpegvideo \
  89. mpc \
  90. mpc8 \
  91. ogg \
  92. rm \
  93. rtsp \
  94. rtp \
  95. sdp \
  96. v4l2 \
  97. vc1 \
  98. wav \
  99. wv \
  100. FFMPEG_CUSTOM_PARSERS:= \
  101. aac \
  102. flac \
  103. ac3 \
  104. h264 \
  105. hevc \
  106. mpegaudio \
  107. mpeg4video \
  108. mpegvideo \
  109. vc1 \
  110. FFMPEG_CUSTOM_PROTOCOLS:= \
  111. file http icecast pipe rtp tcp udp
  112. FFMPEG_MINI_DECODERS:= \
  113. ac3 \
  114. flac \
  115. jpegls \
  116. mp2 \
  117. mp3 \
  118. mpeg1video \
  119. mpeg2video \
  120. mpeg4 \
  121. mpegvideo \
  122. opus \
  123. png \
  124. vorbis \
  125. FFMPEG_PATENTED_MINI_DECODERS:= \
  126. h264 \
  127. hevc \
  128. vc1 \
  129. FFMPEG_MINI_DEMUXERS:= \
  130. avi \
  131. flac \
  132. matroska \
  133. mov \
  134. mp3 \
  135. mpegps \
  136. mpegts \
  137. mpegvideo \
  138. ogg \
  139. FFMPEG_MINI_PROTOCOLS:= \
  140. file
  141. FFMPEG_AUDIO_DECODERS:= \
  142. ac3 \
  143. adpcm_* \
  144. alac \
  145. amrnb \
  146. amrwb \
  147. ape \
  148. atrac3 \
  149. flac \
  150. mp2 \
  151. mp3* \
  152. mpc7 \
  153. mpc8 \
  154. opus \
  155. pcm_* \
  156. vorbis \
  157. wavpack \
  158. zlib \
  159. FFMPEG_AUDIO_DEMUXERS:= \
  160. ac3 \
  161. aiff \
  162. amr \
  163. ape \
  164. avi \
  165. flac \
  166. ffm \
  167. matroska \
  168. mp3 \
  169. mov \
  170. mpc \
  171. mpc8 \
  172. mpegts \
  173. ogg \
  174. rm \
  175. rtsp \
  176. rtp \
  177. sdp \
  178. wav \
  179. wv \
  180. FFMPEG_AUDIO_PROTOCOLS:= \
  181. file http icecast rtp tcp udp
  182. FFMPEG_PATENTED_DECODERS:= \
  183. atrac3 \
  184. h264 \
  185. hevc \
  186. vc1 \
  187. FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENDED_DECODERS)
  188. FFMPEG_PATENTED_MUXERS:= \
  189. h264 \
  190. hevc \
  191. vc1 \
  192. FFMPEG_PATENTED_DEMUXERS:=$(FFMPEG_PATENTED_MUXERS)
  193. FFMPEG_PATENTED_PARSERS:= \
  194. h264 \
  195. hevc \
  196. vc1 \
  197. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  198. PKG_CONFIG_DEPENDS:= \
  199. $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
  200. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
  201. $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_MUXERS)) \
  202. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  203. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
  204. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
  205. include $(INCLUDE_DIR)/package.mk
  206. define Package/ffmpeg/Default
  207. TITLE:=FFmpeg
  208. URL:=https://ffmpeg.org/
  209. DEPENDS+= +libpthread
  210. endef
  211. define Package/ffmpeg/Default/description
  212. FFmpeg is a a software package that can record, convert and stream digital
  213. audio and video in numerous formats.
  214. FFmpeg licensing / patent issues are complex. It is the reponsibility of the
  215. user to understand any requirements in this regard with its usage. See:
  216. https://ffmpeg.org/legal.html for further information.
  217. endef
  218. define Package/ffmpeg
  219. $(call Package/ffmpeg/Default)
  220. SECTION:=multimedia
  221. CATEGORY:=Multimedia
  222. TITLE+= program
  223. DEPENDS+= +libffmpeg-full
  224. VARIANT:=full
  225. endef
  226. define Package/ffmpeg-custom
  227. $(call Package/ffmpeg/Default)
  228. SECTION:=multimedia
  229. CATEGORY:=Multimedia
  230. TITLE+= program (custom)
  231. DEPENDS+= @!ALL libffmpeg-custom
  232. VARIANT:=custom
  233. endef
  234. define Package/ffmpeg/description
  235. $(call Package/ffmpeg/Default/description)
  236. .
  237. This package contains the FFmpeg command line tool.
  238. endef
  239. Package/ffmpeg-custom/description = $(Package/ffmpeg/description)
  240. define Package/ffprobe
  241. $(call Package/ffmpeg/Default)
  242. SECTION:=multimedia
  243. CATEGORY:=Multimedia
  244. TITLE+= CLI media identifier
  245. DEPENDS+= +libffmpeg-full
  246. VARIANT:=full
  247. endef
  248. define Package/ffprobe-custom
  249. $(call Package/ffmpeg/Default)
  250. SECTION:=multimedia
  251. CATEGORY:=Multimedia
  252. TITLE+= CLI media identifier (custom)
  253. DEPENDS+= @!ALL libffmpeg-custom
  254. VARIANT:=custom
  255. endef
  256. define Package/ffprobe/description
  257. $(call Package/ffmpeg/Default/description)
  258. .
  259. This package contains the FFprobe command line tool.
  260. endef
  261. Package/ffprobe-custom/description = $(Package/ffprobe/description)
  262. define Package/ffserver
  263. $(call Package/ffmpeg/Default)
  264. SECTION:=multimedia
  265. CATEGORY:=Multimedia
  266. TITLE+= streaming server
  267. DEPENDS+= +libffmpeg-full
  268. VARIANT:=full
  269. endef
  270. define Package/ffserver-custom
  271. $(call Package/ffmpeg/Default)
  272. SECTION:=multimedia
  273. CATEGORY:=Multimedia
  274. TITLE+= streaming server (custom)
  275. DEPENDS+= @!ALL libffmpeg-custom
  276. VARIANT:=custom
  277. endef
  278. define Package/ffserver/description
  279. $(call Package/ffmpeg/Default/description)
  280. .
  281. This package contains the FFmpeg streaming server.
  282. endef
  283. Package/ffserver-custom/description = $(Package/ffserver/description)
  284. define Package/libffmpeg/Default
  285. $(call Package/ffmpeg/Default)
  286. SECTION:=libs
  287. CATEGORY:=Libraries
  288. TITLE+= libraries
  289. DEPENDS+= +libpthread +zlib +libbz2
  290. PROVIDES:= libffmpeg
  291. endef
  292. # Package build suppressed when CONFIG_ALL=y
  293. define Package/libffmpeg-custom
  294. $(call Package/libffmpeg/Default)
  295. TITLE+= (custom)
  296. DEPENDS+= @!ALL \
  297. +FFMPEG_CUSTOM_SELECT_libopus:libopus \
  298. +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib \
  299. +FFMPEG_CUSTOM_SELECT_libshine:shine \
  300. +PACKAGE_fdk-aac:fdk-aac
  301. VARIANT:=custom
  302. MENU:=1
  303. endef
  304. define Package/libffmpeg-custom/config
  305. source "$(SOURCE)/Config.in"
  306. endef
  307. define Package/libffmpeg-custom/description
  308. $(call Package/ffmpeg/Default/description)
  309. .
  310. This package contains customized FFmpeg shared libraries.
  311. endef
  312. define Package/libffmpeg-audio-dec
  313. $(call Package/libffmpeg/Default)
  314. TITLE+= (audio)
  315. VARIANT:=audio-dec
  316. endef
  317. define Package/libffmpeg-audio-dec/description
  318. $(call Package/ffmpeg/Default/description)
  319. .
  320. This package contains FFmpeg shared libraries for audio decoding
  321. endef
  322. define Package/libffmpeg-full
  323. $(call Package/libffmpeg/Default)
  324. TITLE+= (full)
  325. DEPENDS+= +alsa-lib +PACKAGE_libopus:libopus \
  326. +SOFT_FLOAT:shine \
  327. +!SOFT_FLOAT:lame-lib \
  328. +PACKAGE_libx264:libx264
  329. VARIANT:=full
  330. endef
  331. define Package/libffmpeg-full/description
  332. $(call Package/ffmpeg/Default/description)
  333. .
  334. This package contains full-featured FFmpeg shared libraries.
  335. endef
  336. define Package/libffmpeg-mini
  337. $(call Package/libffmpeg/Default)
  338. TITLE+= (mini)
  339. VARIANT:=mini
  340. endef
  341. define Package/libffmpeg-mini/description
  342. $(call Package/ffmpeg/Default/description)
  343. .
  344. This package contains minimal-featured FFmpeg shared libraries.
  345. endef
  346. # Strip off FPU notation
  347. REAL_CPU_TYPE:=$(firstword $(subst +, ,$(CONFIG_CPU_TYPE)))
  348. # Fixup cpu types recogized by ffmpeg configure
  349. REAL_CPU_TYPE:=$(subst octeonplus,octeon+,$(REAL_CPU_TYPE))
  350. FFMPEG_CONFIGURE:= \
  351. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
  352. LDFLAGS="$(TARGET_LDFLAGS)" \
  353. ./configure \
  354. --enable-cross-compile \
  355. --cross-prefix="$(TARGET_CROSS)" \
  356. --arch="$(ARCH)" \
  357. $(if $(REAL_CPU_TYPE),--cpu=$(call qstrip,$(REAL_CPU_TYPE)),) \
  358. --target-os=linux \
  359. --prefix="/usr" \
  360. --pkg-config="pkg-config" \
  361. --enable-shared \
  362. --enable-static \
  363. --enable-pthreads \
  364. --enable-zlib \
  365. --disable-doc \
  366. --disable-debug \
  367. \
  368. --disable-lzma \
  369. --disable-vaapi \
  370. --disable-vdpau \
  371. --disable-outdevs
  372. ifeq ($(CONFIG_SOFT_FLOAT),y)
  373. FFMPEG_CONFIGURE+= \
  374. --disable-altivec \
  375. --disable-vsx \
  376. --disable-power8 \
  377. --disable-armv5te \
  378. --disable-armv6 \
  379. --disable-armv6t2 \
  380. --disable-inline-asm \
  381. --disable-mipsdsp \
  382. --disable-mipsdspr2 \
  383. --disable-mipsfpu \
  384. --disable-msa \
  385. --disable-mmi \
  386. --disable-fast-unaligned \
  387. --disable-runtime-cpudetect
  388. else ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  389. FFMPEG_CONFIGURE+= \
  390. --disable-runtime-cpudetect
  391. # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
  392. else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),)
  393. FFMPEG_CONFIGURE+= \
  394. --disable-altivec
  395. endif
  396. # libavcodec/mips/aacdec_mips.c build problem
  397. # XXX: disable use of assembly on MIPS. Patches welcome.
  398. ifneq ($(findstring mips,$(CONFIG_ARCH)),)
  399. FFMPEG_CONFIGURE+= \
  400. --disable-asm --disable-inline-asm
  401. endif
  402. # selectively disable optimizations according to arch/cpu type
  403. ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  404. FFMPEG_CONFIGURE+= --enable-lto
  405. ifneq ($(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION)),)
  406. FFMPEG_CONFIGURE+= --enable-vfp
  407. else
  408. FFMPEG_CONFIGURE+= --disable-vfp
  409. endif
  410. ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
  411. FFMPEG_CONFIGURE+= \
  412. --enable-neon \
  413. --enable-vfp
  414. else
  415. FFMPEG_CONFIGURE+= --disable-neon
  416. endif
  417. endif
  418. ifeq ($(ARCH),x86_64)
  419. FFMPEG_CONFIGURE+= --enable-lto
  420. endif
  421. ifneq ($(CONFIG_TARGET_x86),)
  422. ifeq ($(CONFIG_NASM),y)
  423. FFMPEG_CONFIGURE += --enable-x86asm
  424. else
  425. FFMPEG_CONFIGURE += --disable-x86asm
  426. endif
  427. endif
  428. ifeq ($(BUILD_VARIANT),full)
  429. FFMPEG_DISABLE= \
  430. $(foreach c, $(2), \
  431. --disable-$(1)="$(c)" \
  432. )
  433. FFMPEG_CONFIGURE+= \
  434. --enable-avresample \
  435. $(if $(CONFIG_BUILD_PATENTED),, \
  436. $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
  437. $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \
  438. $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
  439. $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
  440. $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
  441. $(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
  442. ifeq ($(CONFIG_SOFT_FLOAT),y)
  443. FFMPEG_CONFIGURE+= \
  444. --enable-small \
  445. \
  446. $(if $(CONFIG_PACKAGE_shine),--enable-libshine)
  447. else
  448. ifeq ($(ARCH),x86_64)
  449. FFMPEG_CONFIGURE+= --enable-hardcoded-tables
  450. else
  451. FFMPEG_CONFIGURE+= --enable-small
  452. endif
  453. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
  454. endif
  455. # x264 support and fdk-aac support can't coexist and be distributed.
  456. # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
  457. ifneq ($(CONFIG_PACKAGE_libx264),)
  458. FFMPEG_CONFIGURE+= \
  459. --enable-gpl \
  460. --enable-libx264
  461. else
  462. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
  463. endif
  464. endif
  465. ifeq ($(BUILD_VARIANT),custom)
  466. FFMPEG_ENABLE= \
  467. $(foreach c, $(2), \
  468. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  469. )
  470. ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y)
  471. FFMPEG_CONFIGURE+= \
  472. --enable-hardcoded-tables
  473. else
  474. FFMPEG_CONFIGURE+= \
  475. --enable-small
  476. endif
  477. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y)
  478. FFMPEG_CONFIGURE+= --enable-gpl
  479. endif
  480. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y)
  481. FFMPEG_CONFIGURE+= --enable-version3
  482. endif
  483. ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y)
  484. FFMPEG_CONFIGURE+= --enable-nonfree
  485. endif
  486. ifneq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  487. FFMPEG_CONFIGURE+= \
  488. --disable-programs \
  489. --disable-avfilter \
  490. --disable-swresample
  491. endif
  492. FFMPEG_CONFIGURE+= \
  493. --disable-swscale \
  494. --disable-everything \
  495. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  496. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  497. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  498. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  499. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  500. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  501. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  502. FFMPEG_CONFIGURE+= \
  503. --enable-decoder=adpcm_ima_wav \
  504. --enable-decoder=adpcm_ima_qt \
  505. --enable-decoder=adpcm_ms
  506. endif
  507. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y)
  508. FFMPEG_CONFIGURE+= \
  509. --enable-libfdk-aac --enable-encoder=libfdk_aac
  510. endif
  511. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y)
  512. FFMPEG_CONFIGURE+= \
  513. --enable-libmp3lame --enable-encoder=libmp3lame
  514. endif
  515. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  516. FFMPEG_CONFIGURE+= \
  517. --enable-libopus --enable-decoder=libopus --enable-encoder=libopus
  518. endif
  519. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y)
  520. FFMPEG_CONFIGURE+= \
  521. --enable-libshine --enable-encoder=libshine
  522. endif
  523. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  524. FFMPEG_CONFIGURE+= \
  525. --enable-libx264 --enable-encoder=libx264
  526. else
  527. FFMPEG_CONFIGURE+= --disable-postproc
  528. endif
  529. endif
  530. ifeq ($(BUILD_VARIANT),audio-dec)
  531. FFMPEG_ENABLE= \
  532. $(foreach c, $(2), \
  533. --enable-$(1)="$(c)" \
  534. )
  535. FFMPEG_CONFIGURE+= \
  536. --enable-small \
  537. --enable-gpl \
  538. \
  539. --disable-programs \
  540. --disable-avfilter \
  541. --disable-postproc \
  542. --disable-swresample \
  543. --disable-swscale \
  544. --disable-everything \
  545. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  546. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  547. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  548. --disable-decoder=pcm_bluray,pcm_dvd
  549. endif
  550. ifeq ($(BUILD_VARIANT),mini)
  551. FFMPEG_ENABLE= \
  552. $(foreach c, $(2), \
  553. --enable-$(1)="$(c)" \
  554. )
  555. FFMPEG_CONFIGURE+= \
  556. --enable-small \
  557. \
  558. --disable-programs \
  559. --disable-avdevice \
  560. --disable-avfilter \
  561. --disable-postproc \
  562. --disable-swresample \
  563. --disable-swscale \
  564. --disable-everything \
  565. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  566. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  567. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  568. $(if $(CONFIG_BUILD_PATENTED), \
  569. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
  570. endif
  571. ifneq ($(CONFIG_TARGET_x86),)
  572. TARGET_CFLAGS+= -fomit-frame-pointer
  573. endif
  574. define Build/Configure
  575. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  576. endef
  577. define Build/Compile
  578. $(MAKE) -C $(PKG_BUILD_DIR) \
  579. DESTDIR="$(PKG_INSTALL_DIR)" \
  580. all install
  581. endef
  582. define Build/InstallDev/custom
  583. $(INSTALL_DIR) $(1)/usr/include
  584. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  585. $(INSTALL_DIR) $(1)/usr/lib
  586. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  587. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  588. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.{a,so*} $(1)/usr/lib/
  589. endif
  590. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  591. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  592. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  593. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  594. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  595. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  596. endif
  597. endef
  598. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  599. define Build/InstallDev/full
  600. $(INSTALL_DIR) $(1)/usr/include
  601. $(INSTALL_DIR) $(1)/usr/lib
  602. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  603. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/
  604. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
  605. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  606. ifneq ($(CONFIG_PACKAGE_libx264),)
  607. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  608. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  609. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  610. endif
  611. endef
  612. define Build/InstallDev/mini
  613. $(INSTALL_DIR) $(1)/usr/include
  614. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  615. $(INSTALL_DIR) $(1)/usr/lib
  616. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  617. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  618. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  619. endef
  620. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  621. # XXX: attempt at installing "best" dev files available
  622. ifeq ($(BUILD_VARIANT),custom)
  623. # XXX: only install "custom" dev files if -full & -mini are not selected
  624. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  625. Build/InstallDev = $(Build/InstallDev/custom)
  626. endif
  627. endif
  628. ifeq ($(BUILD_VARIANT),audio-dec)
  629. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  630. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  631. Build/InstallDev = $(Build/InstallDev/audio-dec)
  632. endif
  633. endif
  634. ifeq ($(BUILD_VARIANT),full)
  635. # XXX: always install "full" dev files if -full is selected
  636. Build/InstallDev = $(Build/InstallDev/full)
  637. endif
  638. ifeq ($(BUILD_VARIANT),mini)
  639. # XXX: only install "mini" dev files if -full is not selected
  640. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  641. Build/InstallDev = $(Build/InstallDev/mini)
  642. endif
  643. endif
  644. define Package/ffmpeg/install
  645. $(INSTALL_DIR) $(1)/usr/bin
  646. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  647. endef
  648. Package/ffmpeg-custom/install = $(Package/ffmpeg/install)
  649. define Package/ffprobe/install
  650. $(INSTALL_DIR) $(1)/usr/bin
  651. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  652. endef
  653. Package/ffprobe-custom/install = $(Package/ffprobe/install)
  654. define Package/ffserver/install
  655. $(INSTALL_DIR) $(1)/usr/bin
  656. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  657. endef
  658. Package/ffserver-custom/install = $(Package/ffserver/install)
  659. define Package/libffmpeg-custom/install
  660. $(INSTALL_DIR) $(1)/usr/lib
  661. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  662. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  663. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  664. endif
  665. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  666. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.so.* $(1)/usr/lib/
  667. endif
  668. endef
  669. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  670. define Package/libffmpeg-full/install
  671. $(INSTALL_DIR) $(1)/usr/lib
  672. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.so.* $(1)/usr/lib/
  673. ifneq ($(CONFIG_PACKAGE_libx264),)
  674. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  675. endif
  676. endef
  677. define Package/libffmpeg-mini/install
  678. $(INSTALL_DIR) $(1)/usr/lib
  679. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  680. endef
  681. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  682. $(eval $(call BuildPackage,ffmpeg))
  683. $(eval $(call BuildPackage,ffprobe))
  684. $(eval $(call BuildPackage,ffserver))
  685. $(eval $(call BuildPackage,ffmpeg-custom))
  686. $(eval $(call BuildPackage,ffprobe-custom))
  687. $(eval $(call BuildPackage,ffserver-custom))
  688. $(eval $(call BuildPackage,libffmpeg-audio-dec))
  689. $(eval $(call BuildPackage,libffmpeg-full))
  690. $(eval $(call BuildPackage,libffmpeg-mini))
  691. $(eval $(call BuildPackage,libffmpeg-custom))