FreeType 2 can now be built in an external directory with the configure script also. * builds/freetype.mk (INCLUDES): Add `OBJ_DIR'. * builds/unix/detect.mk (have_mk): New variable to test for external build. (unix-def.mk): Defined according to value of `have_mk'. * builds/unix/unix.mk (have_mk): New variable to test for external build. Select include paths for unix-def.mk and unix-cc.mk according to value of `have_mk'. * builds/unix/unix-def.in (OBJ_BUILD): New variable. (DISTCLEAN): Use it. * builds/unix/unix-cc.in (LIBTOOL): Define default value only if not yet defined. * builds/unix/install.mk (install): Use `OBJ_BUILD' for installing freetype-config. * configure: Don't depend on bash features. (ft2_dir, abs_curr_dir, abs_ft2_dir): New variables (code partially taken from Autoconf). Build a dummy Makefile if not building in source tree. * docs/INSTALL: Document it.
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 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
diff --git a/ChangeLog b/ChangeLog
index 949e8f1..e8bef62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2002-05-05 Werner Lemberg <wl@gnu.org>
+
+ FreeType 2 can now be built in an external directory with the
+ configure script also.
+
+ * builds/freetype.mk (INCLUDES): Add `OBJ_DIR'.
+
+ * builds/unix/detect.mk (have_mk): New variable to test for
+ external build.
+ (unix-def.mk): Defined according to value of `have_mk'.
+ * builds/unix/unix.mk (have_mk): New variable to test for
+ external build.
+ Select include paths for unix-def.mk and unix-cc.mk according
+ to value of `have_mk'.
+ * builds/unix/unix-def.in (OBJ_BUILD): New variable.
+ (DISTCLEAN): Use it.
+ * builds/unix/unix-cc.in (LIBTOOL): Define default value only
+ if not yet defined.
+ * builds/unix/install.mk (install): Use `OBJ_BUILD' for installing
+ freetype-config.
+
+ * configure: Don't depend on bash features.
+ (ft2_dir, abs_curr_dir, abs_ft2_dir): New variables (code
+ partially taken from Autoconf).
+ Build a dummy Makefile if not building in source tree.
+
+ * docs/INSTALL: Document it.
+
2002-05-04 David Turner <david@freetype.org>
* src/truetype/ttgload.c (TT_Load_Glyph): Finally fixing the last
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 62e42ea..96473d8 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -130,7 +130,7 @@ PROJECT_LIBRARY := $(LIB_)$(LIBRARY).$A
# in the `freetype/builds/<system>' directory, as these
# files will override the default sources.
#
-INCLUDES := $(BUILD) $(TOP)$(SEP)include
+INCLUDES := $(OBJ_DIR) $(BUILD) $(TOP)$(SEP)include
INCLUDE_FLAGS = $(INCLUDES:%=$I%)
diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk
index 6af635c..a6eb658 100644
--- a/builds/unix/detect.mk
+++ b/builds/unix/detect.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -72,8 +72,15 @@ ifeq ($(PLATFORM),unix)
setup: std_setup
- unix-def.mk: $(TOP)/builds/unix/unix-def.in
- cd builds/unix; ./configure $(CFG)
+ have_mk := $(strip $(wildcard $(OBJ_DIR)/Makefile))
+ ifneq ($(have_mk),)
+ # we are building FT2 not in the src tree
+ unix-def.mk: $(TOP)/builds/unix/unix-def.in
+ $(TOP)/builds/unix/configure $(CFG)
+ else
+ unix-def.mk: $(TOP)/builds/unix/unix-def.in
+ cd builds/unix; ./configure $(CFG)
+ endif
endif # test PLATFORM unix
diff --git a/builds/unix/install.mk b/builds/unix/install.mk
index 161ce06..add09b3 100644
--- a/builds/unix/install.mk
+++ b/builds/unix/install.mk
@@ -36,7 +36,7 @@ install: $(PROJECT_LIBRARY)
$(INSTALL_DATA) $$P $(includedir)/freetype2/freetype/cache ; \
done
$(INSTALL_DATA) $(BUILD)/ft2unix.h $(includedir)/ft2build.h
- $(INSTALL_SCRIPT) -m 755 $(BUILD)/freetype-config \
+ $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \
$(bindir)/freetype-config
diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
index 0e53a65..7a87396 100644
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -3,7 +3,9 @@
CC := @CC@
-LIBTOOL := $(BUILD)/libtool
+ifndef LIBTOOL
+ LIBTOOL := $(BUILD)/libtool
+endif
# The object file extension (for standard and static libraries). This can be
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index f7781bc..6fcf06e 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -18,12 +18,17 @@ ifndef TOP
endif
TOP := $(shell cd $(TOP); pwd)
-DELETE := @RMF@
-DELDIR := @RMDIR@
-SEP := /
-HOSTSEP := $(SEP)
-BUILD := $(TOP)/builds/unix
-PLATFORM := unix
+DELETE := @RMF@
+DELDIR := @RMDIR@
+SEP := /
+HOSTSEP := $(SEP)
+BUILD := $(TOP)/builds/unix
+PLATFORM := unix
+
+# this is used for `make distclean' and `make install'
+ifndef OBJ_BUILD
+ OBJ_BUILD := $(BUILD)
+endif
# don't use `:=' here since the path stuff will be included after this file
#
@@ -35,14 +40,15 @@ INSTALL_PROGRAM := @INSTALL_PROGRAM@
INSTALL_SCRIPT := @INSTALL_SCRIPT@
MKINSTALLDIRS := $(BUILD)/mkinstalldirs
-DISTCLEAN += $(BUILD)/config.cache \
- $(BUILD)/config.log \
- $(BUILD)/config.status \
- $(BUILD)/unix-def.mk \
- $(BUILD)/unix-cc.mk \
- $(BUILD)/ftconfig.h \
- $(BUILD)/freetype-config \
- $(LIBTOOL)
+DISTCLEAN += $(OBJ_BUILD)/config.cache \
+ $(OBJ_BUILD)/config.log \
+ $(OBJ_BUILD)/config.status \
+ $(OBJ_BUILD)/unix-def.mk \
+ $(OBJ_BUILD)/unix-cc.mk \
+ $(OBJ_BUILD)/ftconfig.h \
+ $(OBJ_BUILD)/freetype-config \
+ $(LIBTOOL) \
+ $(OBJ_BUILD)/Makefile
# Standard installation variables.
diff --git a/builds/unix/unix.mk b/builds/unix/unix.mk
index 5488d7b..57d951a 100644
--- a/builds/unix/unix.mk
+++ b/builds/unix/unix.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2002 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -12,9 +12,15 @@
# indicate that you have read the license and understand and accept it
# fully.
-
-include $(TOP)/builds/unix/unix-def.mk
-include $(TOP)/builds/unix/unix-cc.mk
+have_mk := $(strip $(wildcard $(TOP)/builds/unix/unix-def.mk))
+ifneq ($(have_mk),)
+ include $(TOP)/builds/unix/unix-def.mk
+ include $(TOP)/builds/unix/unix-cc.mk
+else
+ # we are building FT2 not in the src tree
+ include $(OBJ_DIR)/unix-def.mk
+ include $(OBJ_DIR)/unix-cc.mk
+endif
ifdef BUILD_PROJECT
diff --git a/configure b/configure
index bd4c523..982a1df 100644
--- a/configure
+++ b/configure
@@ -9,14 +9,52 @@
# install
#
-if [ "x$GNUMAKE" = x ]; then
+if test "x$GNUMAKE" = x; then
GNUMAKE=make
fi
-if [ `$GNUMAKE -v 2>/dev/null|grep -ic gnu` -eq 0 ]; then
+if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then
echo "Sorry, GNU make is required to build FreeType2." >&2
echo "Please try \`GNUMAKE=<GNU make command name> $0'." >&2
exit 1
fi
+# Uh, oh. This is taken from autoconf. They know what they are doing...
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ ft_expr=expr
+else
+ ft_expr=false
+fi
+
+ft2_dir=`(dirname "$0") 2>/dev/null ||
+$ft_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+abs_curr_dir=`pwd`
+abs_ft2_dir=`cd "$ft2_dir" && pwd`
+
+# build a dummy Makefile if we are not building in the source tree
+
+if test "$abs_curr_dir" != "$abs_ft2_dir"; then
+ echo "OBJ_DIR=$abs_curr_dir" > Makefile
+ echo "TOP=$abs_ft2_dir" >> Makefile
+ echo "OBJ_BUILD=$abs_curr_dir" >> Makefile
+ echo "LIBTOOL=$abs_curr_dir/libtool" >> Makefile
+ echo "include $abs_ft2_dir/Makefile" >> Makefile
+fi
+
+# call make
+
CFG="$@" $GNUMAKE setup unix
+
+# eof
diff --git a/docs/INSTALL b/docs/INSTALL
index 70caa86..e959ed8 100644
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -35,7 +35,6 @@ II. From the command line
The second one is to use "GNU Make" (and NO OTHER MAKE TOOL).
-
1. Building FT2 with "Jam"
--------------------------
@@ -60,7 +59,6 @@ II. From the command line
should become automatic on Unix systems.
-
2. Building FT2 with "GNU Make"
-------------------------------
@@ -119,8 +117,24 @@ II. From the command line
- make setup lcc -> Win32-LCC
-II. In your own environment (IDE)
----------------------------------
+ If you want to build FreeType 2 in another directory, you must set
+ two environment variables, `OJB_DIR' and `TOP'. The former gives
+ the directory where the object files and the library should be
+ created (this directory must exist), the latter the top directory of
+ the FreeType 2 source tree. Example:
+
+ OBJ_DIR=~/freetype2.compiled TOP=~/freetype2 \
+ make -f$TOP/Makefile setup ansi
+ OBJ_DIR=~/freetype2.compiled TOP=~/freetype2 \
+ make -f$TOP/Makefile
+
+ On Unix boxes, calling `configure' from the build directory is
+ sufficient; it will build a small Makefile which calls the
+ FreeType 2 Makefile with the necessary parameters.
+
+
+III. In your own environment (IDE)
+----------------------------------
You need to add the directories "freetype2/include" to your include
path when compiling the library.