welcome GPLv3! yes, k8jam is GPL'ed now, along with Jambase. because i can.
[k8jam.git] / defaults / Jambase.pkgcfg
blob23b09d4c6857866be2f99342c2eefa2e2f4ecc6a
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
14 # $(1): check string: "glib-2.0 >= 1.3.4"
15 # return empty string if condition is not met
16 rule pkg-config-exists {
17   local cf res ;
18   cf = [ Command "pkg-config --exists '$(1)' 2>/dev/null" : exit-code code-first ] ;
19   if $(cf[1]) = "0" {
20     res = "tan" ;
21   } else {
22     res = ;
23   }
24   return $(res) ;
28 # call $(1)
29 # add output to var $(2)
30 # return resulting (non-empty) string if library is present
31 # if $(2) = "" -- don't add flags, just return
32 # [ lib-config-ex "pkg-config sdl --cflags" : "CFLAGS" ]
33 rule lib-config-ex {
34   local cf lf res ;
35   cf = [ Command "$(1) 2>/dev/null" : parse-output exit-code code-first ] ;
36   if $(cf[1]) = "0" && $(cf[2]) {
37     res = $(cf[2-]) ;
38     if $(2) {
39       $(2) += $(cf[2-]) ;
40     }
41   } else {
42     res = ;
43   }
44   return $(res) ;
48 # call $(1) --cflags and $(1) --libs (many libs provides such configurators)
49 # add necessary flags to compiler and linker vars
50 # return "tan" (non-empty string) if library is present
51 # if $(2) != "" -- don't add flags, just check
52 # [ lib-config "pkg-config sdl" ]
53 rule lib-config {
54   local cf lf hasit ;
56   cf = [ Command "$(1) --cflags 2>/dev/null" : parse-output exit-code code-first ] ;
57   #Echo "cf:" $(cf) ;
58   if $(cf[1]) = "0" && $(cf[2]) {
59     hasit = "tan" ;
60     #Echo "flags:" $(cf[2-]) ;
61     if ! $(2) {
62       CCFLAGS += $(cf[2-]) ;
63       C++FLAGS += $(cf[2-]) ;
64       OBJCFLAGS += $(cf[2-]) ;
65     }
66   }
68   lf = [ Command "$(1) --libs 2>/dev/null" : parse-output exit-code code-first ] ;
69   #Echo "lf:" $(lf) ;
70   if $(lf[1]) = "0" && $(lf[2]) {
71     hasit = "tan" ;
72     #Echo "flags:" $(lf[2-]) ;
73     if ! $(2) {
74       LINKLIBS += $(lf[2-]) ;
75       C++LINKLIBS += $(lf[2-]) ;
76       OBJCLINKLIBS += $(lf[2-]) ;
77     }
78   }
80   return $(hasit) ;
83 rule pkg-config {
84   local res ;
85   res = [ lib-config "pkg-config $(1)" ] ;
86   return $(res) ;
90 rule pkg-config-has {
91   local res ;
92   res = [ lib-config-ex "pkg-config $(1) --cflags --libs" ] ;
93   return $(res) ;