Message ID | 2e3d0aae-32c0-ffc1-d1f5-f76884ab67b2@aracnet.com |
---|---|
State | New |
Headers | show |
On Fri, Apr 14, 2017 at 2:56 AM, Aaron Levinson <alevinsn@aracnet.com> wrote: > From 48f7daba16e0fcdb83d9abd254800c7b9f4ab684 Mon Sep 17 00:00:00 2001 > From: Aaron Levinson <alevinsn@aracnet.com> > Date: Thu, 13 Apr 2017 17:30:47 -0700 > Subject: [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing > > Purpose: Enhanced require_pkg_config() in configure to > fallback to require() if pkg-config is missing > > Notes: This is likely mainly of relevance when building with MSVC on > Windows. In my case, I used this approach to get libmfx when invoking > configure with --enable-libmfx, which is used for QuickSync (QSV). > > Comments: > > -- configure: Enhanced require_pkg_config() function to first check if > $pkg_config is not false. If not false, it goes through the > standard steps of calling use_pkg_config(), but if false, it issues > a log message and then calls require() with all the inputted > arguments and an additional argument: -l$1. So, for something like > "require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit", this becomes > "require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx". This is not a > perfect solution, but the previous approach didn't work at all > before when require_pkg_config() is used. > --- > configure | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 7f2b653..ad08b82 100755 > --- a/configure > +++ b/configure > @@ -1347,7 +1347,12 @@ use_pkg_config(){ > } > > require_pkg_config(){ > - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" > + if test $pkg_config != false; then > + use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" > + else > + log require_pkg_config "No pkg-config, using require for $@" > + require "$@ -l$1" > + fi > } > pkg-config typically provides more then just a location of the files, and while it happens to work for mfx in your case, I don't think this generic fallback is a good idea. We already require a linux-esque build environment, even for MSVC builds (ie. msys or cygwin, etc), having pkg-config on top of the other required tools isn't that hard of a dependency to fullfill - I do that all the time. - Hendrik
On 4/14/2017 1:09 AM, Hendrik Leppkes wrote: > On Fri, Apr 14, 2017 at 2:56 AM, Aaron Levinson <alevinsn@aracnet.com> wrote: >> From 48f7daba16e0fcdb83d9abd254800c7b9f4ab684 Mon Sep 17 00:00:00 2001 >> From: Aaron Levinson <alevinsn@aracnet.com> >> Date: Thu, 13 Apr 2017 17:30:47 -0700 >> Subject: [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing >> >> Purpose: Enhanced require_pkg_config() in configure to >> fallback to require() if pkg-config is missing >> >> Notes: This is likely mainly of relevance when building with MSVC on >> Windows. In my case, I used this approach to get libmfx when invoking >> configure with --enable-libmfx, which is used for QuickSync (QSV). >> >> Comments: >> >> -- configure: Enhanced require_pkg_config() function to first check if >> $pkg_config is not false. If not false, it goes through the >> standard steps of calling use_pkg_config(), but if false, it issues >> a log message and then calls require() with all the inputted >> arguments and an additional argument: -l$1. So, for something like >> "require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit", this becomes >> "require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx". This is not a >> perfect solution, but the previous approach didn't work at all >> before when require_pkg_config() is used. >> --- >> configure | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/configure b/configure >> index 7f2b653..ad08b82 100755 >> --- a/configure >> +++ b/configure >> @@ -1347,7 +1347,12 @@ use_pkg_config(){ >> } >> >> require_pkg_config(){ >> - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" >> + if test $pkg_config != false; then >> + use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" >> + else >> + log require_pkg_config "No pkg-config, using require for $@" >> + require "$@ -l$1" >> + fi >> } >> > > pkg-config typically provides more then just a location of the files, > and while it happens to work for mfx in your case, I don't think this > generic fallback is a good idea. > We already require a linux-esque build environment, even for MSVC > builds (ie. msys or cygwin, etc), having pkg-config on top of the > other required tools isn't that hard of a dependency to fullfill - I > do that all the time. > > - Hendrik OK. Please disregard this patch, and I will submit a different one that does something more specific for libmfx. Thanks, Aaron Levinson
On 4/13/2017 9:56 PM, Aaron Levinson wrote: > From 48f7daba16e0fcdb83d9abd254800c7b9f4ab684 Mon Sep 17 00:00:00 2001 > From: Aaron Levinson <alevinsn@aracnet.com> > Date: Thu, 13 Apr 2017 17:30:47 -0700 > Subject: [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing > > Purpose: Enhanced require_pkg_config() in configure to > fallback to require() if pkg-config is missing > > Notes: This is likely mainly of relevance when building with MSVC on > Windows. In my case, I used this approach to get libmfx when invoking > configure with --enable-libmfx, which is used for QuickSync (QSV). > > Comments: > > -- configure: Enhanced require_pkg_config() function to first check if > $pkg_config is not false. If not false, it goes through the > standard steps of calling use_pkg_config(), but if false, it issues > a log message and then calls require() with all the inputted > arguments and an additional argument: -l$1. So, for something like > "require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit", this becomes > "require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx". This is not a > perfect solution, but the previous approach didn't work at all > before when require_pkg_config() is used. > --- > configure | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 7f2b653..ad08b82 100755 > --- a/configure > +++ b/configure > @@ -1347,7 +1347,12 @@ use_pkg_config(){ > } > > require_pkg_config(){ > - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" > + if test $pkg_config != false; then > + use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" > + else > + log require_pkg_config "No pkg-config, using require for $@" > + require "$@ -l$1" > + fi This will fail in a thousand ways with packages that require other packages, specific cflags, specific ldflags, or that state specific versions. As Hendrik said, pkg-config is not just a fancy way to add -I and -L options to the compiler and linker.
On 4/14/2017 6:04 PM, James Almer wrote: > On 4/13/2017 9:56 PM, Aaron Levinson wrote: >> From 48f7daba16e0fcdb83d9abd254800c7b9f4ab684 Mon Sep 17 00:00:00 2001 >> From: Aaron Levinson <alevinsn@aracnet.com> >> Date: Thu, 13 Apr 2017 17:30:47 -0700 >> Subject: [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing >> >> Purpose: Enhanced require_pkg_config() in configure to >> fallback to require() if pkg-config is missing >> >> Notes: This is likely mainly of relevance when building with MSVC on >> Windows. In my case, I used this approach to get libmfx when invoking >> configure with --enable-libmfx, which is used for QuickSync (QSV). >> >> Comments: >> >> -- configure: Enhanced require_pkg_config() function to first check if >> $pkg_config is not false. If not false, it goes through the >> standard steps of calling use_pkg_config(), but if false, it issues >> a log message and then calls require() with all the inputted >> arguments and an additional argument: -l$1. So, for something like >> "require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit", this becomes >> "require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx". This is not a >> perfect solution, but the previous approach didn't work at all >> before when require_pkg_config() is used. >> --- >> configure | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/configure b/configure >> index 7f2b653..ad08b82 100755 >> --- a/configure >> +++ b/configure >> @@ -1347,7 +1347,12 @@ use_pkg_config(){ >> } >> >> require_pkg_config(){ >> - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" >> + if test $pkg_config != false; then >> + use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" >> + else >> + log require_pkg_config "No pkg-config, using require for $@" >> + require "$@ -l$1" >> + fi > > This will fail in a thousand ways with packages that require other > packages, specific cflags, specific ldflags, or that state specific > versions. > As Hendrik said, pkg-config is not just a fancy way to add -I and -L > options to the compiler and linker. I responded earlier today to Hendrik's response and indicated that I was abandoning the patch. I just submitted a new patch that does something more specific for libmfx. Thanks, Aaron Levinson
diff --git a/configure b/configure index 7f2b653..ad08b82 100755 --- a/configure +++ b/configure @@ -1347,7 +1347,12 @@ use_pkg_config(){ } require_pkg_config(){ - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" + if test $pkg_config != false; then + use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message" + else + log require_pkg_config "No pkg-config, using require for $@" + require "$@ -l$1" + fi } require_libfreetype(){
From 48f7daba16e0fcdb83d9abd254800c7b9f4ab684 Mon Sep 17 00:00:00 2001 From: Aaron Levinson <alevinsn@aracnet.com> Date: Thu, 13 Apr 2017 17:30:47 -0700 Subject: [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing Purpose: Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing Notes: This is likely mainly of relevance when building with MSVC on Windows. In my case, I used this approach to get libmfx when invoking configure with --enable-libmfx, which is used for QuickSync (QSV). Comments: -- configure: Enhanced require_pkg_config() function to first check if $pkg_config is not false. If not false, it goes through the standard steps of calling use_pkg_config(), but if false, it issues a log message and then calls require() with all the inputted arguments and an additional argument: -l$1. So, for something like "require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit", this becomes "require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx". This is not a perfect solution, but the previous approach didn't work at all before when require_pkg_config() is used. --- configure | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)