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'
138 #command lin set defaults
139 #for your information: harbuzz C API is shit when enabling c90 pedantic compilation
140 slib_cc_default
='gcc -Wall -Wextra -Wno-missing-field-initializers -c -fPIC -O2 -std=c90'
141 slib_ccld_default
="gcc -shared -Wl,-soname=$slib_soname"
142 alib_ar_default
='ar rucs'
143 ln_s_default
='ln -sf'
144 disable_glib_default
=no
146 set_default
$PATHS_LIST
147 set_default alib_ar 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 --slib-cc=CC use C compiler command line CC for shared lib object[$slib_cc_default]
172 --slib-ccld=CCLD use linker command line LD for shared lib [$slib_ccld_default]
173 --alib-ar=AR use archive command line AR to create the static library archive [$alib_ar_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 #-------------------------------------------------------------------------------
203 CPPFLAGS
="-I./ -I$src_path \
204 $(pkg-config --cflags freetype2) \
207 if test x
$disable_glib = xno
; then
208 CPPFLAGS
="$CPPFLAGS -DHAVE_GLIB \
209 $(pkg-config --cflags glib-2.0) \
212 #-------------------------------------------------------------------------------
214 #generate the version header file
216 s/@HB_VERSION_MAJOR@/$major/
217 s/@HB_VERSION_MINOR@/$minor/
218 s/@HB_VERSION_MICRO@/$micro/
219 s/@HB_VERSION@/$major.$minor.$micro/
220 " $src_path/hb-version.h.
in >hb-version.h
222 #evaluate the final paths (depth of one)
223 eval "e_incdir=$incdir"
224 eval "e_libdir=$libdir"
226 #generate the pkg-config file
229 s:%exec_prefix%:$prefix:
230 s:%libdir%:$e_libdir:
231 s:%includedir%:$e_incdir:
232 s:%VERSION%:$major.$minor.$micro:
233 " $src_path/harfbuzz.pc.
in >harfbuzz.pc
235 #compile source files, build a list of objet files
236 for src_file
in $srcs
240 echo "SLIB_CC $src_file"
241 $slib_cc $CPPFLAGS -o "$obj" "$src_path/$src_file"
246 echo "SLIB_CCLD $slib_file_name"
248 mkdir
-p "fake_root/$e_libdir"
249 $slib_ccld -o "fake_root/$e_libdir/$slib_file_name" $objs $
(pkg-config
--libs freetype2
)
251 #install the other files in the fake root
252 ln -sf "$slib_file_name" "fake_root/$e_libdir/$slib_soname"
253 ln -sf "$slib_soname" "fake_root/$e_libdir/libharfbuzz.so"
255 # create the library archive
256 echo "ALIB_AR libharfbuzz.a"
257 $alib_ar fake_root
$e_libdir/libharfbuzz.a
$objs
259 mkdir
-p "fake_root/$e_libdir/pkgconfig"
260 cp -f harfbuzz.pc fake_root
/$e_libdir/pkgconfig
/harfbuzz.pc
262 mkdir
-p "fake_root/$e_incdir/harfbuzz"
265 cp -f $src_path/$hdr "fake_root/$e_incdir/harfbuzz/$hdr"
266 cp -f hb-version.h
"fake_root/$e_incdir/harfbuzz/"