-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathwxwidgets.cygclass
236 lines (220 loc) · 7.65 KB
/
wxwidgets.cygclass
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
################################################################################
#
# wxwidgets.cygclass - functions for building wxWidgets-dependent packages
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006-2020 Cygport authors
# Provided by the Cygwin project <https://cygwin.com/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cygport. If not, see <https://www.gnu.org/licenses/>.
#
################################################################################
#****h* Cygclasses/wxwidgets.cygclass
# SYNOPSIS
# WX_VERSION="X.Y"
# [WX_CODESET="..."]
# [WX_TOOLKIT="..."]
# inherit wxwidgets
# DESCRIPTION
# The wxWidgets toolkit is a cross-platform, C++ GUI toolkit which is built
# on top of other GUI toolkits for a native look on all platforms. Each
# combination of major.minor version, backend toolkit, and choice of ANSI or
# Unicode text codesets are parallel-installable. Packages which depend on
# the wxWidgets toolkit will only build against one or two versions at any
# given time, and may require a particular codeset or toolkit.
#
# This cygclass selects the wx-config script for the desired version, backend
# tookit, and codeset of the wxWidgets toolkit.
# NOTE
# When cross-compiling, cross.cygclass must be inherit()ed BEFORE
# wxwidgets.cygclass.
#****
#****v* wxwidgets.cygclass/WX_VERSION
# DESCRIPTION
# The desired major.minor branch of the wxWidgets toolkit. This variable must
# be set before inherit()ing the wxwidgets.cygclass.
# NOTE
# Even minor version numbers represent stable branches; versions 2.8, 3.0
# and 3.1 are supported.
#****
#****v* wxwidgets.cygclass/WX_TOOLKIT
# DESCRIPTION
# The desired backend toolkit version of the wxWidgets toolkit. Possible
# values are:
# * cocoa: (until 2.8) for Mac OS X Cocoa
# * dfb: for DirectFB (usually Linux embedded)
# * gtk2: the 2.x default for modern X11 desktop platforms, including Cygwin
# * gtk3: the 3.x default for modern X11 desktop platforms, including Cygwin
# * gtk: for older X11 platforms with the deprecated 1.x version of GTK+
# * mac: (until 2.8) for Mac OS X Carbon
# * mgl: for SciTech MGL cross-platform graphics library (default on DJGPP)
# * microwin: for Microwindows (aka Nano X)
# * motif: for X11 systems using Motif/LessTif (default on older UNIXes)
# * msw: for Microsoft Windows (default on MinGW)
# * osx_carbon: (since 3.0) for Mac OS X Carbon interface
# * osx_cocoa: (since 3.0) for Mac OS X Cocoa interface
# * osx_iphone: (since 3.0) for iOS devices (iPhone/iPod Touch)
# * pm: for OS/2 EMX
# * x11: for X11 systems without another GUI toolkit
#
# This variable must be set before inherit()ing the wxwidgets.cygclass.
# If undefined, the default on Cygwin is "gtk2" for 2.x and "gtk3" for 3.x;
# when cross-compiling, the default depends on CROSS_HOST as indicated above.
#****
#****v* wxwidgets.cygclass/WX_CODESET
# DESCRIPTION
# The choice of text codeset of the wxWidgets toolkit. Possible values are
# "ansi" and "unicode", however the "gtk" (1.x) and "motif" WX_TOOLKIT options
# do not support "unicode".
#
# This variable must be set before inherit()ing the wxwidgets.cygclass.
# If undefined, "unicode" is the default if supported by the given WX_TOOLKIT.
#****
_wx_find_config() {
local carbon
local _release
case ${WX_VERSION} in
2.[68])
carbon="mac"
gtk="gtk2"
_release="-release"
;;
3.*)
carbon="osx_carbon"
gtk="gtk3"
_release=
;;
'') error "WX_VERSION must be defined" ;;
*) error "wxWidgets ${WX_VERSION} is not yet supported" ;;
esac
if ! defined WX_TOOLKIT
then
# roughly based on wxWidgets configure.in DEFAULT_DEFAULT_wxUSE_*
case ${CHOST} in
*-aix*|*-dgux*|*-hpux*|*-irix*|*-osf*|*-sunos*|*-sysv*)
WX_TOOLKIT=motif ;;
arm-apple-darwin*)
WX_TOOLKIT=osx_iphone ;;
*-darwin*) WX_TOOLKIT=${carbon} ;;
*-msdos*) WX_TOOLKIT=mgl ;;
*-mingw*) WX_TOOLKIT=msw ;;
*-os2*emx) WX_TOOLKIT=pm ;;
*-qnx*) WX_TOOLKIT=x11 ;;
*) WX_TOOLKIT=${gtk} ;;
esac
fi
case ${WX_TOOLKIT} in
*u) WX_TOOLKIT=${WX_TOOLKIT%u}
WX_CODESET=unicode
;;
esac
case ${WX_TOOLKIT} in
# what a mess...
cocoa)
case ${WX_VERSION} in
2.[68]) ;;
*) error "Use WX_TOOLKIT=osx_cocoa for wxWidgets 3.0+"
esac ;;
mac)
case ${WX_VERSION} in
2.[68]) ;;
*) error "Use WX_TOOLKIT=osx_carbon for wxWidgets 3.0+"
esac ;;
osx_carbon)
case ${WX_VERSION} in
2.[68]) error "Use WX_TOOLKIT=mac for wxWidgets 2.6/2.8"
esac ;;
osx_cocoa)
case ${WX_VERSION} in
2.[68]) error "Use WX_TOOLKIT=cocoa for wxWidgets 2.6/2.8"
esac ;;
osx_iphone)
case ${WX_VERSION} in
2.[68]) error "wxWidgets osx_iphone requires at least 3.0"
esac ;;
gtk3)
case ${WX_VERSION} in
2.[68]) error "wxWidgets gtk3 requires at least 3.0"
esac ;;
dfb|mgl|microwin|x11) WX_TOOLKIT+=univ ;;
dfbuniv|mgluniv|microwinuniv|x11univ) ;;
base|gtk|gtk2|motif|msw|pm|x11) ;;
*) error "Unknown or unsupported wxWidgets toolkit for version ${WX_VERSION}"
esac
case ${WX_CODESET} in
unicode)
case ${WX_TOOLKIT} in
gtk|motif) error "wxWidgets ${WX_TOOLKIT} is only available in ANSI" ;;
esac
;;
ansi) ;;
'')
case ${WX_TOOLKIT} in
gtk|motif) WX_CODESET="ansi" ;;
*) WX_CODESET="unicode" ;;
esac
;;
*) error "Unknown value for WX_CODESET; must be 'ansi' or 'unicode'" ;;
esac
if cross_compiling
then
WX_CONFIG=$(${CXX} -print-sysroot)$(__target_prefix)/lib/wx/config/${CROSS_HOST}${CROSS_HOST:+-}${WX_TOOLKIT}-${WX_CODESET}${_release}-${WX_VERSION}
else
WX_CONFIG=$(__host_prefix)/lib/wx/config/${WX_TOOLKIT}-${WX_CODESET}${_release}-${WX_VERSION}
fi
if [ -f ${WX_CONFIG} ]
then
inform "Using wxWidgets ${WX_CONFIG##*/}"
else
error "could not find ${WX_CONFIG##*/}"
fi
export WX_CONFIG
# used by wxwin.m4
export WX_CONFIG_NAME=${WX_CONFIG}
export WXRC=$(which wxrc-${WX_VERSION} 2> /dev/null)
}
#****d* wxwidgets.cygclass/WX_CONFIG
# DESCRIPTION
# Absolute path to the wx-config script for the given WX_VERSION, WX_TOOLKIT,
# and WX_CODESET (and CROSS_HOST if cross-compiling). This definition is
# exported to the build environment.
#****
_wx_find_config
#****d* wxwidgets.cygclass/WX_CFLAGS
# DESCRIPTION
# Compile flags for the specified version/toolkit/codeset of wxWidgets. This
# is equivalent to `$WX_CONFIG --cflags`.
#****
WX_CFLAGS="$(${WX_CONFIG} --cflags)"
#****d* wxwidgets.cygclass/WX_LIBS
# DESCRIPTION
# Link flags for the specified version/toolkit/codeset of wxWidgets. This
# is equivalent to `$WX_CONFIG --libs`.
# NOTE
# This will contain the standard, non-"contrib" link libraries shipped with
# wxWidgets. If you need to link against one of the "contrib" libraries, you
# need to call `$WX_CONFIG --libs library1,library2,...`. In this form,
# WX_CONFIG will automatically add 'base', but not 'core', which almost all
# wxWidgets GUI applications will need. Third-party link library flags cannot
# be determined by WX_CONFIG and will need to be added manually.
#****
WX_LIBS="$(${WX_CONFIG} --libs)"
#****f* wxwidgets.cygclass/wx-config
# DESCRIPTION
# Wrapper function for calling WX_CONFIG.
#****
wx-config() {
${WX_CONFIG} ${@}
}
readonly -f _wx_find_config wx-config