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.

796 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:=2
  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. ifeq ($(CONFIG_FFMPEG_X86ASM),y)
  421. FFMPEG_CONFIGURE += --enable-x86asm
  422. else
  423. FFMPEG_CONFIGURE += --disable-x86asm
  424. endif
  425. ifeq ($(BUILD_VARIANT),full)
  426. FFMPEG_DISABLE= \
  427. $(foreach c, $(2), \
  428. --disable-$(1)="$(c)" \
  429. )
  430. FFMPEG_CONFIGURE+= \
  431. --enable-avresample \
  432. $(if $(CONFIG_BUILD_PATENTED),, \
  433. $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
  434. $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \
  435. $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
  436. $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
  437. $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
  438. $(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
  439. ifeq ($(CONFIG_SOFT_FLOAT),y)
  440. FFMPEG_CONFIGURE+= \
  441. --enable-small \
  442. \
  443. $(if $(CONFIG_PACKAGE_shine),--enable-libshine)
  444. else
  445. ifeq ($(ARCH),x86_64)
  446. FFMPEG_CONFIGURE+= --enable-hardcoded-tables
  447. else
  448. FFMPEG_CONFIGURE+= --enable-small
  449. endif
  450. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
  451. endif
  452. # x264 support and fdk-aac support can't coexist and be distributed.
  453. # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
  454. ifneq ($(CONFIG_PACKAGE_libx264),)
  455. FFMPEG_CONFIGURE+= \
  456. --enable-gpl \
  457. --enable-libx264
  458. else
  459. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
  460. endif
  461. endif
  462. ifeq ($(BUILD_VARIANT),custom)
  463. FFMPEG_ENABLE= \
  464. $(foreach c, $(2), \
  465. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  466. )
  467. ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y)
  468. FFMPEG_CONFIGURE+= \
  469. --enable-hardcoded-tables
  470. else
  471. FFMPEG_CONFIGURE+= \
  472. --enable-small
  473. endif
  474. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y)
  475. FFMPEG_CONFIGURE+= --enable-gpl
  476. endif
  477. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y)
  478. FFMPEG_CONFIGURE+= --enable-version3
  479. endif
  480. ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y)
  481. FFMPEG_CONFIGURE+= --enable-nonfree
  482. endif
  483. ifneq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  484. FFMPEG_CONFIGURE+= \
  485. --disable-programs \
  486. --disable-avfilter \
  487. --disable-swresample
  488. endif
  489. FFMPEG_CONFIGURE+= \
  490. --disable-swscale \
  491. --disable-everything \
  492. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  493. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  494. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  495. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  496. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  497. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  498. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  499. FFMPEG_CONFIGURE+= \
  500. --enable-decoder=adpcm_ima_wav \
  501. --enable-decoder=adpcm_ima_qt \
  502. --enable-decoder=adpcm_ms
  503. endif
  504. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y)
  505. FFMPEG_CONFIGURE+= \
  506. --enable-libfdk-aac --enable-encoder=libfdk_aac
  507. endif
  508. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y)
  509. FFMPEG_CONFIGURE+= \
  510. --enable-libmp3lame --enable-encoder=libmp3lame
  511. endif
  512. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  513. FFMPEG_CONFIGURE+= \
  514. --enable-libopus --enable-decoder=libopus --enable-encoder=libopus
  515. endif
  516. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y)
  517. FFMPEG_CONFIGURE+= \
  518. --enable-libshine --enable-encoder=libshine
  519. endif
  520. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  521. FFMPEG_CONFIGURE+= \
  522. --enable-libx264 --enable-encoder=libx264
  523. else
  524. FFMPEG_CONFIGURE+= --disable-postproc
  525. endif
  526. endif
  527. ifeq ($(BUILD_VARIANT),audio-dec)
  528. FFMPEG_ENABLE= \
  529. $(foreach c, $(2), \
  530. --enable-$(1)="$(c)" \
  531. )
  532. FFMPEG_CONFIGURE+= \
  533. --enable-small \
  534. --enable-gpl \
  535. \
  536. --disable-programs \
  537. --disable-avfilter \
  538. --disable-postproc \
  539. --disable-swresample \
  540. --disable-swscale \
  541. --disable-everything \
  542. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  543. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  544. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  545. --disable-decoder=pcm_bluray,pcm_dvd
  546. endif
  547. ifeq ($(BUILD_VARIANT),mini)
  548. FFMPEG_ENABLE= \
  549. $(foreach c, $(2), \
  550. --enable-$(1)="$(c)" \
  551. )
  552. FFMPEG_CONFIGURE+= \
  553. --enable-small \
  554. \
  555. --disable-programs \
  556. --disable-avdevice \
  557. --disable-avfilter \
  558. --disable-postproc \
  559. --disable-swresample \
  560. --disable-swscale \
  561. --disable-everything \
  562. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  563. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  564. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  565. $(if $(CONFIG_BUILD_PATENTED), \
  566. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
  567. endif
  568. ifneq ($(CONFIG_TARGET_x86),)
  569. TARGET_CFLAGS+= -fomit-frame-pointer
  570. endif
  571. define Build/Configure
  572. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  573. endef
  574. define Build/Compile
  575. $(MAKE) -C $(PKG_BUILD_DIR) \
  576. DESTDIR="$(PKG_INSTALL_DIR)" \
  577. all install
  578. endef
  579. define Build/InstallDev/custom
  580. $(INSTALL_DIR) $(1)/usr/include
  581. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  582. $(INSTALL_DIR) $(1)/usr/lib
  583. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  584. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  585. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.{a,so*} $(1)/usr/lib/
  586. endif
  587. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  588. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  589. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  590. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  591. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  592. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  593. endif
  594. endef
  595. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  596. define Build/InstallDev/full
  597. $(INSTALL_DIR) $(1)/usr/include
  598. $(INSTALL_DIR) $(1)/usr/lib
  599. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  600. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/
  601. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
  602. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  603. ifneq ($(CONFIG_PACKAGE_libx264),)
  604. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  605. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  606. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  607. endif
  608. endef
  609. define Build/InstallDev/mini
  610. $(INSTALL_DIR) $(1)/usr/include
  611. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  612. $(INSTALL_DIR) $(1)/usr/lib
  613. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  614. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  615. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  616. endef
  617. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  618. # XXX: attempt at installing "best" dev files available
  619. ifeq ($(BUILD_VARIANT),custom)
  620. # XXX: only install "custom" dev files if -full & -mini are not selected
  621. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  622. Build/InstallDev = $(Build/InstallDev/custom)
  623. endif
  624. endif
  625. ifeq ($(BUILD_VARIANT),audio-dec)
  626. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  627. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  628. Build/InstallDev = $(Build/InstallDev/audio-dec)
  629. endif
  630. endif
  631. ifeq ($(BUILD_VARIANT),full)
  632. # XXX: always install "full" dev files if -full is selected
  633. Build/InstallDev = $(Build/InstallDev/full)
  634. endif
  635. ifeq ($(BUILD_VARIANT),mini)
  636. # XXX: only install "mini" dev files if -full is not selected
  637. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  638. Build/InstallDev = $(Build/InstallDev/mini)
  639. endif
  640. endif
  641. define Package/ffmpeg/install
  642. $(INSTALL_DIR) $(1)/usr/bin
  643. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  644. endef
  645. Package/ffmpeg-custom/install = $(Package/ffmpeg/install)
  646. define Package/ffprobe/install
  647. $(INSTALL_DIR) $(1)/usr/bin
  648. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  649. endef
  650. Package/ffprobe-custom/install = $(Package/ffprobe/install)
  651. define Package/ffserver/install
  652. $(INSTALL_DIR) $(1)/usr/bin
  653. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  654. endef
  655. Package/ffserver-custom/install = $(Package/ffserver/install)
  656. define Package/libffmpeg-custom/install
  657. $(INSTALL_DIR) $(1)/usr/lib
  658. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  659. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y)
  660. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  661. endif
  662. ifeq ($(CONFIG_FFMPEG_CUSTOM_PROGRAMS),y)
  663. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avfilter,swresample}.so.* $(1)/usr/lib/
  664. endif
  665. endef
  666. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  667. define Package/libffmpeg-full/install
  668. $(INSTALL_DIR) $(1)/usr/lib
  669. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.so.* $(1)/usr/lib/
  670. ifneq ($(CONFIG_PACKAGE_libx264),)
  671. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  672. endif
  673. endef
  674. define Package/libffmpeg-mini/install
  675. $(INSTALL_DIR) $(1)/usr/lib
  676. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  677. endef
  678. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  679. $(eval $(call BuildPackage,ffmpeg))
  680. $(eval $(call BuildPackage,ffprobe))
  681. $(eval $(call BuildPackage,ffserver))
  682. $(eval $(call BuildPackage,ffmpeg-custom))
  683. $(eval $(call BuildPackage,ffprobe-custom))
  684. $(eval $(call BuildPackage,ffserver-custom))
  685. $(eval $(call BuildPackage,libffmpeg-audio-dec))
  686. $(eval $(call BuildPackage,libffmpeg-full))
  687. $(eval $(call BuildPackage,libffmpeg-mini))
  688. $(eval $(call BuildPackage,libffmpeg-custom))