3 # stolen from ffmpeg configure like a pig
5 # Prevent locale nonsense from breaking basic text processing.
12 slib_file_name
=libharfbuzz.so.
$major.
$minor.
$micro
13 slib_soname
=libharfbuzz.so.
$major
69 rm -f harfbuzz.pc hb-version.h
73 ################################################################################
79 src_path
=$
(cd $
(dirname "$0"); pwd)
80 echo "$src_path" |
grep -q '[[:blank:]]' &&
81 die
"Out of tree builds are impossible with whitespace in source path."
82 test -e "$src_path/config.h" &&
83 die
"Out of tree builds are impossible with config.h in source dir."
90 [ $var = $value ] && return 0
98 eval "$var=\"\$$var $*\""
102 echo "Unknown option \"$1\"."
103 echo "See $0 --help for available options."
109 eval : \
${$opt:=\$${opt}_default}
134 prefix_default
='/usr/local'
135 incdir_default
='$prefix/include'
136 libdir_default
='$prefix/lib'
137 pkg_config_sysroot
=''
139 #command lin set defaults
140 #for your information: harbuzz C API is shit when enabling c90 pedantic compilation
141 slib_cc_default
='gcc -Wall -Wextra -Wno-missing-field-initializers -c -fpic -O0 -std=c90'
142 slib_ccld_default
="gcc -shared -Wl,-soname=$slib_soname"
143 ln_s_default
='ln -sf'
144 disable_glib_default
=no
146 set_default
$PATHS_LIST
147 set_default slib_cc slib_ccld disable_glib
151 Usage: make [options] [operations]
153 Operations: [default is to build the shared library]:
154 clean clean build products
157 Options: [defaults in brackets after descriptions]
160 --help print this message
163 --disable-glib disable glib support [glib support is enabled]
165 Path options for pkg-config file:
166 --prefix=PREFIX install in PREFIX [$prefix_default]
167 --libdir=DIR install libs in DIR [$incdir_default]
168 --incdir=DIR install includes in DIR [$libdir_default]
170 Advanced options (experts only):
171 --pkg-config-sysroot=SYSROOT if you need to tell pkg-config that you cross-compile
172 --slib-cc=CC use C compiler command line CC for shared lib object[$slib_cc_default]
173 --slib-ccld=CCLD use linker command line LD for shared lib [$slib_ccld_default]
185 --disable-glib) disable_glib
=yes
189 optname
="${optname#--}"
190 optname
=$
(echo "$optname" |
sed 's/-/_/g')
191 if is_in
$optname $CMDLINE_SET; then
192 eval $optname='$optval'
193 elif is_in
$optname $CMDLINE_APPEND; then
194 append
$optname "$optval"
202 #for pkgconfig to pickup the right package files
203 if test -n "$pkg_config_sysroot"; then
204 export PKG_CONFIG_SYSROOT_DIR
=$pkg_config_sysroot
207 #-------------------------------------------------------------------------------
208 CPPFLAGS
="-I./ -I$src_path \
209 $(pkg-config --cflags freetype2) \
212 if test x
$disable_glib = xno
; then
213 CPPFLAGS
="$CPPFLAGS -DHAVE_GLIB \
214 $(pkg-config --cflags glib-2.0) \
217 #-------------------------------------------------------------------------------
219 #generate the version header file
221 s/@HB_VERSION_MAJOR@/$major/
222 s/@HB_VERSION_MINOR@/$minor/
223 s/@HB_VERSION_MICRO@/$micro/
224 s/@HB_VERSION@/$major.$minor.$micro/
225 " $src_path/hb-version.h.
in >hb-version.h
227 #evaluate the final paths (depth of one)
228 eval "e_incdir=$incdir"
229 eval "e_libdir=$libdir"
231 #generate the pkg-config file
234 s:%exec_prefix%:$prefix:
235 s:%libdir%:$e_libdir:
236 s:%includedir%:$e_incdir:
237 s:%VERSION%:$major.$minor.$micro:
238 " $src_path/harfbuzz.pc.
in >harfbuzz.pc
240 #compile source files, build a list of objet files
241 for src_file
in $srcs
245 echo "SLIB_CC $src_file"
246 $slib_cc $CPPFLAGS -o "$obj" "$src_path/$src_file"
251 echo "SLIB_CCLD $slib_file_name"
253 mkdir
-p "fake_root/$e_libdir"
254 $slib_ccld -o "fake_root/$e_libdir/$slib_file_name" $objs
256 #install the other files in the fake root
257 ln -sf "$slib_file_name" "fake_root/$e_libdir/$slib_soname"
258 ln -sf "$slib_soname" "fake_root/$e_libdir/libharfbuzz.so"
260 mkdir
-p "fake_root/$e_libdir/pkgconfig"
261 cp -f harfbuzz.pc fake_root
/$e_libdir/pkgconfig
/harfbuzz.pc
263 mkdir
-p "fake_root/$e_incdir/harfbuzz"
266 cp -f $src_path/$hdr "fake_root/$e_incdir/harfbuzz/$hdr"
267 cp -f hb-version.h
"fake_root/$e_incdir/harfbuzz/"