mirror of https://gitlab.com/nakst/essence
67 lines
3.4 KiB
Plaintext
67 lines
3.4 KiB
Plaintext
#import "util/get_source.script" get_source;
|
|
|
|
str targetName #option;
|
|
str toolchainPrefix #option;
|
|
int processorCount #option;
|
|
|
|
void Start() {
|
|
if processorCount == 0 processorCount = SystemGetProcessorCount();
|
|
|
|
if !PathExists("bin/harfbuzz") {
|
|
get_source.Get("https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.4.tar.xz", "harfbuzz-2.6.4",
|
|
"9413b8d96132d699687ef914ebb8c50440efc87b3f775d25856d7ec347c03c12");
|
|
assert PathMove("bin/source", "bin/harfbuzz");
|
|
assert SystemShellExecuteWithWorkingDirectory("bin/harfbuzz",
|
|
"./configure --with-glib=no --with-icu=no --with-freetype=no --with-cairo=no --with-fontconfig=no --enable-shared "
|
|
+ "CFLAGS=\"-g -O3 -DHB_TINY\" CXXFLAGS=\"-g -O3 -DHB_TINY\"");
|
|
assert FileCopy("ports/harfbuzz/essence-config.h", "bin/harfbuzz/config.h");
|
|
|
|
str sed = "sed";
|
|
if StringTrim(SystemShellEvaluate("uname")) == "Darwin" sed = "gsed";
|
|
str[] headers = [ "assert", "atomic", "builtins", "float", "locale", "math", "stdio", "stdlib", "string", "unistd", "xlocale" ];
|
|
|
|
for int i = 0; i < headers:len(); i += 1 {
|
|
assert SystemShellExecuteWithWorkingDirectory("bin/harfbuzz/src",
|
|
"find . -type f -exec %sed% -i 's/#include <%headers[i]%.h>/#include <essence.h>/g' {} \\;");
|
|
}
|
|
}
|
|
|
|
if !PathExists("root/Applications/POSIX/include/harfbuzz") {
|
|
assert PathCreateLeadingDirectories("root/Applications/POSIX/include/harfbuzz");
|
|
assert SystemShellExecute("cp -p bin/harfbuzz/src/*.h root/Applications/POSIX/include/harfbuzz");
|
|
}
|
|
|
|
if !PathExists("bin/harfbuzz/libharfbuzz_%targetName%.a") {
|
|
str[] sources = [
|
|
"hb-aat-layout", "hb-aat-map", "hb-blob", "hb-buffer-serialize",
|
|
"hb-buffer", "hb-common", "hb-face", "hb-fallback-shape",
|
|
"hb-font", "hb-map", "hb-number", "hb-ot-cff1-table",
|
|
"hb-ot-cff2-table", "hb-ot-color", "hb-ot-face", "hb-ot-font",
|
|
"hb-ot-layout", "hb-ot-map", "hb-ot-math", "hb-ot-meta",
|
|
"hb-ot-metrics", "hb-ot-name", "hb-ot-shape-complex-arabic", "hb-ot-shape-complex-default",
|
|
"hb-ot-shape-complex-hangul", "hb-ot-shape-complex-hebrew", "hb-ot-shape-complex-indic-table", "hb-ot-shape-complex-indic",
|
|
"hb-ot-shape-complex-khmer", "hb-ot-shape-complex-myanmar", "hb-ot-shape-complex-thai", "hb-ot-shape-complex-use-table",
|
|
"hb-ot-shape-complex-use", "hb-ot-shape-complex-vowel-constraints", "hb-ot-shape-fallback", "hb-ot-shape-normalize",
|
|
"hb-ot-shape", "hb-ot-tag", "hb-ot-var", "hb-set",
|
|
"hb-shape-plan", "hb-shape", "hb-shaper", "hb-static",
|
|
"hb-ucd", "hb-unicode", "hb-ft"
|
|
];
|
|
|
|
str link = "%toolchainPrefix%-ar cr libharfbuzz.a ";
|
|
|
|
for int i = 0; i < sources:len(); i += 1 {
|
|
assert SystemShellExecuteWithWorkingDirectory("bin/harfbuzz/src",
|
|
"%toolchainPrefix%-gcc -c %sources[i]%.cc -o %sources[i]%.o "
|
|
+ "-DHAVE_CONFIG_H -I. -I.. -ffreestanding -fno-rtti -g -O3 -DHB_TINY -fno-exceptions -fno-threadsafe-statics "
|
|
+ "-fvisibility-inlines-hidden -DHB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR -I../../../root/Applications/POSIX/include");
|
|
link += sources[i] + ".o ";
|
|
}
|
|
|
|
assert SystemShellExecuteWithWorkingDirectory("bin/harfbuzz/src", link);
|
|
assert SystemShellExecuteWithWorkingDirectory("bin/harfbuzz/src", "%toolchainPrefix%-ranlib libharfbuzz.a");
|
|
assert FileCopy("bin/harfbuzz/src/libharfbuzz.a", "bin/harfbuzz/libharfbuzz_%targetName%.a");
|
|
}
|
|
|
|
assert FileCopy("bin/harfbuzz/libharfbuzz_%targetName%.a", "root/Applications/POSIX/lib/libharfbuzz.a");
|
|
}
|