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.

798 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.7
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_SOURCE_URL:=https://ffmpeg.org/releases/
  14. PKG_HASH:=efd01782fd29b62505c973f5b61a65632d7b435dc9f4a6c97e92e6afd36cf5c8
  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.0-or-later
  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_CONFIG_DEPENDS:= \
  198. $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
  199. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
  200. $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_MUXERS)) \
  201. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  202. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
  203. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
  204. include $(INCLUDE_DIR)/package.mk
  205. define Package/ffmpeg/Default
  206. TITLE:=FFmpeg
  207. URL:=https://ffmpeg.org/
  208. DEPENDS+= +libpthread
  209. endef
  210. define Package/ffmpeg/Default/description
  211. FFmpeg is a a software package that can record, convert and stream digital
  212. audio and video in numerous formats.
  213. FFmpeg licensing / patent issues are complex. It is the reponsibility of the
  214. user to understand any requirements in this regard with its usage. See:
  215. https://ffmpeg.org/legal.html for further information.
  216. endef
  217. define Package/ffmpeg
  218. $(call Package/ffmpeg/Default)
  219. SECTION:=multimedia
  220. CATEGORY:=Multimedia
  221. TITLE+= program
  222. DEPENDS+= +libffmpeg-full
  223. VARIANT:=full
  224. endef
  225. define Package/ffmpeg-custom
  226. $(call Package/ffmpeg/Default)
  227. SECTION:=multimedia
  228. CATEGORY:=Multimedia
  229. TITLE+= program (custom)
  230. DEPENDS+= @!ALL libffmpeg-custom
  231. VARIANT:=custom
  232. endef
  233. define Package/ffmpeg/description
  234. $(call Package/ffmpeg/Default/description)
  235. .
  236. This package contains the FFmpeg command line tool.
  237. endef
  238. Package/ffmpeg-custom/description = $(Package/ffmpeg/description)
  239. define Package/ffprobe
  240. $(call Package/ffmpeg/Default)
  241. SECTION:=multimedia
  242. CATEGORY:=Multimedia
  243. TITLE+= CLI media identifier
  244. DEPENDS+= +libffmpeg-full
  245. VARIANT:=full
  246. endef
  247. define Package/ffprobe-custom
  248. $(call Package/ffmpeg/Default)
  249. SECTION:=multimedia
  250. CATEGORY:=Multimedia
  251. TITLE+= CLI media identifier (custom)
  252. DEPENDS+= @!ALL libffmpeg-custom
  253. VARIANT:=custom
  254. endef
  255. define Package/ffprobe/description
  256. $(call Package/ffmpeg/Default/description)
  257. .
  258. This package contains the FFprobe command line tool.
  259. endef
  260. Package/ffprobe-custom/description = $(Package/ffprobe/description)
  261. define Package/ffserver
  262. $(call Package/ffmpeg/Default)
  263. SECTION:=multimedia
  264. CATEGORY:=Multimedia
  265. TITLE+= streaming server
  266. DEPENDS+= +libffmpeg-full
  267. VARIANT:=full
  268. endef
  269. define Package/ffserver-custom
  270. $(call Package/ffmpeg/Default)
  271. SECTION:=multimedia
  272. CATEGORY:=Multimedia
  273. TITLE+= streaming server (custom)
  274. DEPENDS+= @!ALL libffmpeg-custom
  275. VARIANT:=custom
  276. endef
  277. define Package/ffserver/description
  278. $(call Package/ffmpeg/Default/description)
  279. .
  280. This package contains the FFmpeg streaming server.
  281. endef
  282. Package/ffserver-custom/description = $(Package/ffserver/description)
  283. define Package/libffmpeg/Default
  284. $(call Package/ffmpeg/Default)
  285. SECTION:=libs
  286. CATEGORY:=Libraries
  287. TITLE+= libraries
  288. DEPENDS+= +libpthread +zlib +libbz2
  289. PROVIDES:= libffmpeg
  290. endef
  291. # Package build suppressed when CONFIG_ALL=y
  292. define Package/libffmpeg-custom
  293. $(call Package/libffmpeg/Default)
  294. TITLE+= (custom)
  295. DEPENDS+= @!ALL \
  296. +FFMPEG_CUSTOM_SELECT_libopus:libopus \
  297. +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib \
  298. +FFMPEG_CUSTOM_SELECT_libshine:shine \
  299. +PACKAGE_fdk-aac:fdk-aac
  300. VARIANT:=custom
  301. MENU:=1
  302. endef
  303. define Package/libffmpeg-custom/config
  304. source "$(SOURCE)/Config.in"
  305. endef
  306. define Package/libffmpeg-custom/description
  307. $(call Package/ffmpeg/Default/description)
  308. .
  309. This package contains customized FFmpeg shared libraries.
  310. endef
  311. define Package/libffmpeg-audio-dec
  312. $(call Package/libffmpeg/Default)
  313. TITLE+= (audio)
  314. VARIANT:=audio-dec
  315. endef
  316. define Package/libffmpeg-audio-dec/description
  317. $(call Package/ffmpeg/Default/description)
  318. .
  319. This package contains FFmpeg shared libraries for audio decoding
  320. endef
  321. define Package/libffmpeg-full
  322. $(call Package/libffmpeg/Default)
  323. TITLE+= (full)
  324. DEPENDS+= +alsa-lib +PACKAGE_libopus:libopus \
  325. +SOFT_FLOAT:shine \
  326. +!SOFT_FLOAT:lame-lib \
  327. +PACKAGE_libx264:libx264
  328. VARIANT:=full
  329. endef
  330. define Package/libffmpeg-full/description
  331. $(call Package/ffmpeg/Default/description)
  332. .
  333. This package contains full-featured FFmpeg shared libraries.
  334. endef
  335. define Package/libffmpeg-mini
  336. $(call Package/libffmpeg/Default)
  337. TITLE+= (mini)
  338. VARIANT:=mini
  339. endef
  340. define Package/libffmpeg-mini/description
  341. $(call Package/ffmpeg/Default/description)
  342. .
  343. This package contains minimal-featured FFmpeg shared libraries.
  344. endef
  345. # Strip off FPU notation
  346. REAL_CPU_TYPE:=$(firstword $(subst +, ,$(CONFIG_CPU_TYPE)))
  347. # Fixup cpu types recogized by ffmpeg configure
  348. REAL_CPU_TYPE:=$(subst octeonplus,octeon+,$(REAL_CPU_TYPE))
  349. FFMPEG_CONFIGURE:= \
  350. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
  351. LDFLAGS="$(TARGET_LDFLAGS)" \
  352. ./configure \
  353. --enable-cross-compile \
  354. --cross-prefix="$(TARGET_CROSS)" \
  355. --arch="$(ARCH)" \
  356. $(if $(REAL_CPU_TYPE),--cpu=$(call qstrip,$(REAL_CPU_TYPE)),) \
  357. --target-os=linux \
  358. --prefix="/usr" \
  359. --pkg-config="pkg-config" \
  360. --enable-shared \
  361. --enable-static \
  362. --enable-pthreads \
  363. --enable-zlib \
  364. --disable-doc \
  365. --disable-debug \
  366. \
  367. --disable-lzma \
  368. --disable-vaapi \
  369. --disable-vdpau \
  370. --disable-outdevs
  371. ifeq ($(CONFIG_SOFT_FLOAT),y)
  372. FFMPEG_CONFIGURE+= \
  373. --disable-altivec \
  374. --disable-vsx \
  375. --disable-power8 \
  376. --disable-armv5te \
  377. --disable-armv6 \
  378. --disable-armv6t2 \
  379. --disable-inline-asm \
  380. --disable-mipsdsp \
  381. --disable-mipsdspr2 \
  382. --disable-mipsfpu \
  383. --disable-msa \
  384. --disable-mmi \
  385. --disable-fast-unaligned \
  386. --disable-runtime-cpudetect
  387. else ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  388. FFMPEG_CONFIGURE+= \
  389. --disable-runtime-cpudetect
  390. # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
  391. else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),)
  392. FFMPEG_CONFIGURE+= \
  393. --disable-altivec
  394. endif
  395. # libavcodec/mips/aacdec_mips.c build problem
  396. # XXX: disable use of assembly on MIPS. Patches welcome.
  397. ifneq ($(findstring mips,$(CONFIG_ARCH)),)
  398. FFMPEG_CONFIGURE+= \
  399. --disable-asm --disable-inline-asm
  400. endif
  401. # selectively disable optimizations according to arch/cpu type
  402. ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  403. FFMPEG_CONFIGURE+= --enable-lto
  404. ifneq ($(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION)),)
  405. FFMPEG_CONFIGURE+= --enable-vfp
  406. else
  407. FFMPEG_CONFIGURE+= --disable-vfp
  408. endif
  409. ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
  410. FFMPEG_CONFIGURE+= \
  411. --enable-neon \
  412. --enable-vfp
  413. else
  414. FFMPEG_CONFIGURE+= --disable-neon
  415. endif
  416. endif
  417. ifeq ($(ARCH),x86_64)
  418. FFMPEG_CONFIGURE+= --enable-lto
  419. endif
  420. ifneq ($(CONFIG_TARGET_x86),)
  421. ifeq ($(CONFIG_NASM),y)
  422. FFMPEG_CONFIGURE += --enable-x86asm
  423. else
  424. FFMPEG_CONFIGURE += --disable-x86asm
  425. endif
  426. endif
  427. ifeq ($(BUILD_VARIANT),full)
  428. FFMPEG_DISABLE= \
  429. $(foreach c, $(2), \
  430. --disable-$(1)="$(c)" \
  431. )
  432. FFMPEG_CONFIGURE+= \
  433. --enable-avresample \
  434. $(if $(CONFIG_BUILD_PATENTED),, \
  435. $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
  436. $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \
  437. $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
  438. $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
  439. $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
  440. $(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
  441. ifeq ($(CONFIG_SOFT_FLOAT),y)
  442. FFMPEG_CONFIGURE+= \
  443. --enable-small \
  444. \
  445. $(if $(CONFIG_PACKAGE_shine),--enable-libshine)
  446. else
  447. ifeq ($(ARCH),x86_64)
  448. FFMPEG_CONFIGURE+= --enable-hardcoded-tables
  449. else
  450. FFMPEG_CONFIGURE+= --enable-small
  451. endif
  452. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
  453. endif
  454. # x264 support and fdk-aac support can't coexist and be distributed.
  455. # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
  456. ifneq ($(CONFIG_PACKAGE_libx264),)
  457. FFMPEG_CONFIGURE+= \
  458. --enable-gpl \
  459. --enable-libx264
  460. else
  461. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
  462. endif
  463. endif
  464. ifeq ($(BUILD_VARIANT),custom)
  465. FFMPEG_ENABLE= \
  466. $(foreach c, $(2), \
  467. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  468. )
  469. ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y)
  470. FFMPEG_CONFIGURE+= \
  471. --enable-hardcoded-tables
  472. else
  473. FFMPEG_CONFIGURE+= \
  474. --enable-small
  475. endif
  476. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y)
  477. FFMPEG_CONFIGURE+= --enable-gpl
  478. endif
  479. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y)
  480. FFMPEG_CONFIGURE+= --enable-version3
  481. endif
  482. ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y)
  483. FFMPEG_CONFIGURE+= --enable-nonfree
  484. endif
  485. ifneq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  486. FFMPEG_CONFIGURE+= \
  487. --disable-programs \
  488. --disable-avfilter \
  489. --disable-swresample
  490. endif
  491. FFMPEG_CONFIGURE+= \
  492. --disable-swscale \
  493. --disable-everything \
  494. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  495. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  496. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  497. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  498. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  499. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  500. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  501. FFMPEG_CONFIGURE+= \
  502. --enable-decoder=adpcm_ima_wav \
  503. --enable-decoder=adpcm_ima_qt \
  504. --enable-decoder=adpcm_ms
  505. endif
  506. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y)
  507. FFMPEG_CONFIGURE+= \
  508. --enable-libfdk-aac --enable-encoder=libfdk_aac
  509. endif
  510. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y)
  511. FFMPEG_CONFIGURE+= \
  512. --enable-libmp3lame --enable-encoder=libmp3lame
  513. endif
  514. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  515. FFMPEG_CONFIGURE+= \
  516. --enable-libopus --enable-decoder=libopus --enable-encoder=libopus
  517. endif
  518. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y)
  519. FFMPEG_CONFIGURE+= \
  520. --enable-libshine --enable-encoder=libshine
  521. endif
  522. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  523. FFMPEG_CONFIGURE+= \
  524. --enable-libx264 --enable-encoder=libx264
  525. else
  526. FFMPEG_CONFIGURE+= --disable-postproc
  527. endif
  528. endif
  529. ifeq ($(BUILD_VARIANT),audio-dec)
  530. FFMPEG_ENABLE= \
  531. $(foreach c, $(2), \
  532. --enable-$(1)="$(c)" \
  533. )
  534. FFMPEG_CONFIGURE+= \
  535. --enable-small \
  536. --enable-gpl \
  537. \
  538. --disable-programs \
  539. --disable-avfilter \
  540. --disable-postproc \
  541. --disable-swresample \
  542. --disable-swscale \
  543. --disable-everything \
  544. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  545. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  546. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  547. --disable-decoder=pcm_bluray,pcm_dvd
  548. endif
  549. ifeq ($(BUILD_VARIANT),mini)
  550. FFMPEG_ENABLE= \
  551. $(foreach c, $(2), \
  552. --enable-$(1)="$(c)" \
  553. )
  554. FFMPEG_CONFIGURE+= \
  555. --enable-small \
  556. \
  557. --disable-programs \
  558. --disable-avdevice \
  559. --disable-avfilter \
  560. --disable-postproc \
  561. --disable-swresample \
  562. --disable-swscale \
  563. --disable-everything \
  564. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  565. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  566. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  567. $(if $(CONFIG_BUILD_PATENTED), \
  568. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
  569. endif
  570. ifneq ($(CONFIG_TARGET_x86),)
  571. TARGET_CFLAGS+= -fomit-frame-pointer
  572. endif
  573. define Build/Configure
  574. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  575. endef
  576. define Build/Compile
  577. $(MAKE) -C $(PKG_BUILD_DIR) \
  578. DESTDIR="$(PKG_INSTALL_DIR)" \
  579. all install
  580. endef
  581. define Build/InstallDev/custom
  582. $(INSTALL_DIR) $(1)/usr/include
  583. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  584. $(INSTALL_DIR) $(1)/usr/lib
  585. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  586. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  587. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.{a,so*} $(1)/usr/lib/
  588. endif
  589. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  590. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  591. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  592. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  593. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  594. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  595. endif
  596. endef
  597. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  598. define Build/InstallDev/full
  599. $(INSTALL_DIR) $(1)/usr/include
  600. $(INSTALL_DIR) $(1)/usr/lib
  601. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  602. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/
  603. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
  604. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  605. ifneq ($(CONFIG_PACKAGE_libx264),)
  606. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  607. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  608. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  609. endif
  610. endef
  611. define Build/InstallDev/mini
  612. $(INSTALL_DIR) $(1)/usr/include
  613. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  614. $(INSTALL_DIR) $(1)/usr/lib
  615. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  616. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  617. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  618. endef
  619. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  620. # XXX: attempt at installing "best" dev files available
  621. ifeq ($(BUILD_VARIANT),custom)
  622. # XXX: only install "custom" dev files if -full & -mini are not selected
  623. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  624. Build/InstallDev = $(Build/InstallDev/custom)
  625. endif
  626. endif
  627. ifeq ($(BUILD_VARIANT),audio-dec)
  628. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  629. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  630. Build/InstallDev = $(Build/InstallDev/audio-dec)
  631. endif
  632. endif
  633. ifeq ($(BUILD_VARIANT),full)
  634. # XXX: always install "full" dev files if -full is selected
  635. Build/InstallDev = $(Build/InstallDev/full)
  636. endif
  637. ifeq ($(BUILD_VARIANT),mini)
  638. # XXX: only install "mini" dev files if -full is not selected
  639. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  640. Build/InstallDev = $(Build/InstallDev/mini)
  641. endif
  642. endif
  643. define Package/ffmpeg/install
  644. $(INSTALL_DIR) $(1)/usr/bin
  645. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  646. endef
  647. Package/ffmpeg-custom/install = $(Package/ffmpeg/install)
  648. define Package/ffprobe/install
  649. $(INSTALL_DIR) $(1)/usr/bin
  650. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  651. endef
  652. Package/ffprobe-custom/install = $(Package/ffprobe/install)
  653. define Package/ffserver/install
  654. $(INSTALL_DIR) $(1)/usr/bin
  655. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  656. endef
  657. Package/ffserver-custom/install = $(Package/ffserver/install)
  658. define Package/libffmpeg-custom/install
  659. $(INSTALL_DIR) $(1)/usr/lib
  660. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  661. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  662. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  663. endif
  664. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  665. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.so.* $(1)/usr/lib/
  666. endif
  667. endef
  668. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  669. define Package/libffmpeg-full/install
  670. $(INSTALL_DIR) $(1)/usr/lib
  671. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.so.* $(1)/usr/lib/
  672. ifneq ($(CONFIG_PACKAGE_libx264),)
  673. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  674. endif
  675. endef
  676. define Package/libffmpeg-mini/install
  677. $(INSTALL_DIR) $(1)/usr/lib
  678. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  679. endef
  680. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  681. $(eval $(call BuildPackage,ffmpeg))
  682. $(eval $(call BuildPackage,ffprobe))
  683. $(eval $(call BuildPackage,ffserver))
  684. $(eval $(call BuildPackage,ffmpeg-custom))
  685. $(eval $(call BuildPackage,ffprobe-custom))
  686. $(eval $(call BuildPackage,ffserver-custom))
  687. $(eval $(call BuildPackage,libffmpeg-audio-dec))
  688. $(eval $(call BuildPackage,libffmpeg-full))
  689. $(eval $(call BuildPackage,libffmpeg-mini))
  690. $(eval $(call BuildPackage,libffmpeg-custom))