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.

753 lines
18 KiB

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