File: fix-pkgconfig-cross

package info (click to toggle)
fosfat 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 560 kB
  • sloc: ansic: 3,052; sh: 837; makefile: 549
file content (77 lines) | stat: -rw-r--r-- 2,512 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Description: Fix cross-build
 pkg-config needs to be called with the cross prefix as well
Author: Jakob Haufe <sur5r@debian.org>
Applied-Upstream: 89274c97bea623bc2e76ea41faecc3ed45a21884
Last-Update: 2024-10-09

--- a/configure
+++ b/configure
@@ -365,10 +365,10 @@ check_pkgconfig(){
     ccflags="${3:---cflags}"
     clibs="${4:---libs}"
     err=1
-    if `which pkg-config 1>/dev/null 2>&1`; then
-      cflags=`pkg-config $pkg $ccflags`
+    if `which $pkgconfig 1>/dev/null 2>&1`; then
+      cflags=`$pkgconfig $pkg $ccflags`
       [ -n "$cflags" ] && check_cflags "$cflags"
-      libs=`pkg-config $pkg $clibs`
+      libs=`$pkgconfig $pkg $clibs`
       if [ -n "$libs" ]; then
         temp_extralibs "$libs"
         check_func $func
@@ -409,7 +409,7 @@ check_lib_version() {
     local min_ver toobig_ver
     min_ver="$2"
     toobig_ver="$3"
-    check_cmd pkg-config --print-errors --exists "$1 >= $min_ver $1 < $toobig_ver" 2>>$logfile
+    check_cmd $pkgconfig --print-errors --exists "$1 >= $min_ver $1 < $toobig_ver" 2>>$logfile
     err=$?
     return $err
 }
@@ -445,9 +445,9 @@ EOF
 }
 
 add_pkgconfig_deps() {
-    if `which pkg-config 1>/dev/null 2>&1`; then
-      add_cflags `pkg-config "$1" --cflags 2>>$logfile`
-      add_extralibs `pkg-config "$1" --libs 2>>$logfile`
+    if `which $pkgconfig 1>/dev/null 2>&1`; then
+      add_cflags `$pkgconfig "$1" --cflags 2>>$logfile`
+      add_extralibs `$pkgconfig "$1" --libs 2>>$logfile`
     fi
 }
 
@@ -480,6 +480,7 @@ docdir='${PREFIX}/share/doc'
 mandir='$(PREFIX)/share/man'
 static="yes"
 shared="yes"
+pkgconfig="pkg-config"
 cc="gcc"
 host_cc="gcc"
 ar="ar"
@@ -594,6 +595,7 @@ fi
 
 if [ -n "$cross_prefix" ]; then
   cross_compile="yes"
+  pkgconfig="${cross_prefix}${pkgconfig}"
   cc="${cross_prefix}${cc}"
   ar="${cross_prefix}${ar}"
   ranlib="${cross_prefix}${ranlib}"
@@ -903,7 +905,7 @@ if enabled doc; then
 fi
 
 # Add all extralibs provided by the pkgconfig files
-[ -n "$pkgconfig_requires" ] && add_extralibs `pkg-config $pkgconfig_requires --libs`
+[ -n "$pkgconfig_requires" ] && add_extralibs `$pkgconfig $pkgconfig_requires --libs`
 
 
 #################################################
@@ -914,6 +916,7 @@ echolog "Blupi says: configure is OK"
 echolog "  version            $VERSION"
 echolog "configuration:"
 echolog "  install prefix     $PREFIX"
+echolog "  pkg-config         $pkgconfig"
 echolog "  C compiler         $cc"
 echolog "  AR                 $ar"
 echolog "  RANLIB             $ranlib"