File tree Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,19 @@ repository = "https://github.com/imager-io/ffmpeg-dev-rs"
1111readme = " README.md"
1212exclude = [" assets" , " examples" ]
1313
14+ [features ]
15+ default = []
16+ gpl = []
17+ x264 = [" x264-dev" ]
18+
1419[dependencies ]
1520libc = " ^0.2"
1621num_cpus = " 1.11.1"
22+ x264-dev = { path = " ../x264-dev" , optional = true }
1723
1824[build-dependencies ]
1925tar = " 0.4.26"
2026flate2 = " 1.0.12"
2127bindgen = " 0.51"
2228num_cpus = " 1.11.1"
23- cc = " 1.0.46"
29+ cc = " 1.0.46"
Original file line number Diff line number Diff line change @@ -239,15 +239,41 @@ fn build() {
239239 "--disable-doc" ,
240240 "--disable-autodetect" ,
241241 ] ;
242+
243+ let mut pkg_config_path = env:: var_os ( "PKG_CONFIG_PATH" ) ;
244+
245+ if env:: var_os ( "CARGO_FEATURE_GPL" ) . is_some ( ) {
246+ configure_flags. push ( "--enable-gpl" ) ;
247+ }
248+
249+ if env:: var_os ( "CARGO_FEATURE_X264" ) . is_some ( ) {
250+ configure_flags. push ( "--enable-libx264" ) ;
251+ let mut x264_pkg_config = env:: var_os ( "DEP_X264_PKGCONFIG" ) . unwrap ( ) ;
252+
253+ // append existing pkg_config path - make sure x264's pkgconfig has precedence:
254+ if let Some ( path) = pkg_config_path {
255+ x264_pkg_config. push ( ":" ) ;
256+ x264_pkg_config. push ( path) ;
257+ }
258+
259+ pkg_config_path = Some ( x264_pkg_config) ;
260+ }
261+
242262 // TRY TO SPEED THIS UP FOR DEV BUILDS
243263 if is_debug_mode ( ) && opt_level_eq ( 0 ) {
244264 configure_flags. push ( "--disable-optimizations" ) ;
245- configure_flags. push ( "--disable -debug" ) ;
265+ configure_flags. push ( "--enable -debug" ) ;
246266 configure_flags. push ( "--disable-stripping" ) ;
247267 }
248268
249269 let eval_configure = |flags : & [ & str ] | {
250- Command :: new ( "./configure" )
270+ let mut configure = Command :: new ( "./configure" ) ;
271+
272+ if let Some ( path) = & pkg_config_path {
273+ configure. env ( "PKG_CONFIG_PATH" , path) ;
274+ }
275+
276+ configure
251277 . current_dir ( & source_path)
252278 . args ( flags)
253279 . output ( )
You can’t perform that action at this time.
0 commit comments