Skip to content

Commit

Permalink
[FontForge] Don't disable default programs. Syntax update for patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Nov 3, 2023
1 parent f2242c5 commit 3bdf216
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions fontforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ fun File.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false
return this
}

fun File.patch(patch: String) {
patch(projectDir.resolve("patches").resolve(patch))
}

fun File.patch(patch: File) {
val pb = ProcessBuilder(
if (isFile) listOf("patch", "-p0", absolutePath)
Expand Down Expand Up @@ -111,30 +115,30 @@ tasks.extractSrc {

// pthread_cancel unavailable on Android
// @TODO: implement a proper workaround
srcDir.resolve("gutils/gio.c").patch(projectDir.resolve("patches/gutils-gio.no-pthread-cancel.patch"))
srcDir.resolve("gutils/gio.c").patch("gutils-gio.no-pthread-cancel.patch")

// fontforgeexe/startnoui.c
srcDir.resolve("fontforgeexe/startnoui.c").patch(projectDir.resolve("patches/fontforgeexe-startnoui.FindOrMakeEncoding.patch"))
srcDir.resolve("fontforgeexe/startnoui.c").patch("fontforgeexe-startnoui.FindOrMakeEncoding.patch")

// https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
srcDir.resolve("config.h.in").patch(projectDir.resolve("patches/file_offset_bits.patch"))
srcDir.resolve("config.h.in").patch("file_offset_bits.patch")

// android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h
// #if __ANDROID_API__ >= 26
// struct passwd* getpwent(void) __INTRODUCED_IN(26);
// void setpwent(void) __INTRODUCED_IN(26);
// void endpwent(void) __INTRODUCED_IN(26);
// #endif /* __ANDROID_API__ >= 26 */
srcDir.resolve("gutils/fsys.c").patch(projectDir.resolve("patches/gutils-fsys.patch"))
srcDir.resolve("gutils/fsys.c").patch("gutils-fsys.patch")

// https://android.googlesource.com/platform/bionic/+/master/docs/status.md
// New libc functions in P (API level 28):
// endhostent/endnetent/endprotoent/getnetent/getprotoent/sethostent/setnetent/setprotoent (completing <netdb.h>)
srcDir.resolve("gutils/gutils.c").patch(projectDir.resolve("patches/gutils-gutils.patch"))
srcDir.resolve("gutils/gutils.c").patch("gutils-gutils.patch")

// Leak some memory by not calling endhostent() and endprotoent()
// These are deprecated functions, not used in the current upstream version of fontforge
srcDir.resolve("fontforge/http.c").patch(projectDir.resolve("patches/fontforge-http.patch"))
srcDir.resolve("fontforge/http.c").patch("fontforge-http.patch")

// Fix sent upstream:
// https://github.com/fontforge/fontforge/pull/3746
Expand All @@ -145,7 +149,7 @@ tasks.extractSrc {
// char* nl_langinfo(nl_item __item) __INTRODUCED_IN(26);
// char* nl_langinfo_l(nl_item __item, locale_t __l) __INTRODUCED_IN(26);
// #endif /* __ANDROID_API__ >= 26 */
srcDir.resolve("fontforge/noprefs.c").patch(projectDir.resolve("patches/fontforge-noprefs.NL_LANGINFO.patch"))
srcDir.resolve("fontforge/noprefs.c").patch("fontforge-noprefs.NL_LANGINFO.patch")

if (minSupportedSdk < 21) {
// fontforge uses newlocale and localeconv, which are not available on Android pre 21 (Lollipop)
Expand All @@ -161,11 +165,11 @@ tasks.extractSrc {
// #if __ANDROID_API__ >= 21
// struct lconv* localeconv(void) __INTRODUCED_IN(21);
// #endif /* __ANDROID_API__ >= 21 */
srcDir.patch(projectDir.resolve("patches/localeconv.patch"))
srcDir.patch("localeconv.patch")
}

// rpl_localtime calls itself until stack exhaustion
srcDir.resolve("lib/localtime-buffer.c").patch(projectDir.resolve("patches/lib-localtime-buffer.patch"))
srcDir.resolve("lib/localtime-buffer.c").patch("lib-localtime-buffer.patch")
}

if (portVersion == "20230101") {
Expand Down Expand Up @@ -200,7 +204,6 @@ if (portVersion == "20170731") {
val generatedDependencies = prefabGenerated.get().asFile
autoconf {
args(
"--disable-programs",
"--disable-python-scripting",
"--disable-python-extension",
"--without-included-ltdl",
Expand Down

0 comments on commit 3bdf216

Please sign in to comment.