diff --git a/tur/opendylan/0001-fix-linking.patch b/tur/opendylan/0001-fix-linking.patch new file mode 100644 index 0000000000..f43124bc22 --- /dev/null +++ b/tur/opendylan/0001-fix-linking.patch @@ -0,0 +1,50 @@ +diff --git a/sources/jamfiles/aarch64-linux-build.jam b/sources/jamfiles/aarch64-linux-build.jam +index 50c5eea38..fe1dad42f 100644 +--- a/sources/jamfiles/aarch64-linux-build.jam ++++ b/sources/jamfiles/aarch64-linux-build.jam +@@ -23,4 +23,4 @@ include $(SYSTEM_BUILD_SCRIPTS)/posix-build.jam ; + # + # Overrides/redefinitions + # +-rtclibs += -lpthread -ldl -lrt ; ++rtclibs += -ldl ; +diff --git a/sources/jamfiles/arm-linux-build.jam b/sources/jamfiles/arm-linux-build.jam +index 7d07ffec8..0d5319a85 100644 +--- a/sources/jamfiles/arm-linux-build.jam ++++ b/sources/jamfiles/arm-linux-build.jam +@@ -23,4 +23,4 @@ include $(SYSTEM_BUILD_SCRIPTS)/posix-build.jam ; + # + # Overrides/redefinitions + # +-rtclibs += -lpthread -ldl -lrt ; ++rtclibs += -ldl ; +diff --git a/sources/jamfiles/riscv64-linux-build.jam b/sources/jamfiles/riscv64-linux-build.jam +index 4c70f2835..8c95d3589 100644 +--- a/sources/jamfiles/riscv64-linux-build.jam ++++ b/sources/jamfiles/riscv64-linux-build.jam +@@ -23,4 +23,4 @@ include $(SYSTEM_BUILD_SCRIPTS)/posix-build.jam ; + # + # Overrides/redefinitions + # +-rtclibs += -lpthread -ldl -lrt ; ++rtclibs += -ldl -lrt ; +diff --git a/sources/jamfiles/x86-linux-build.jam b/sources/jamfiles/x86-linux-build.jam +index b811fc404..6acc56114 100644 +--- a/sources/jamfiles/x86-linux-build.jam ++++ b/sources/jamfiles/x86-linux-build.jam +@@ -24,4 +24,4 @@ include $(SYSTEM_BUILD_SCRIPTS)/posix-build.jam ; + # + # Overrides/redefinitions + # +-rtclibs += -lpthread -ldl -lrt ; ++rtclibs += -ldl ; +diff --git a/sources/jamfiles/x86_64-linux-build.jam b/sources/jamfiles/x86_64-linux-build.jam +index ea88e95ab..8e125bde3 100644 +--- a/sources/jamfiles/x86_64-linux-build.jam ++++ b/sources/jamfiles/x86_64-linux-build.jam +@@ -24,4 +24,4 @@ include $(SYSTEM_BUILD_SCRIPTS)/posix-build.jam ; + # + # Overrides/redefinitions + # +-rtclibs += -lpthread -ldl -lrt ; ++rtclibs += -ldl ; diff --git a/tur/opendylan/0002-fix-warning-as-error.patch b/tur/opendylan/0002-fix-warning-as-error.patch new file mode 100644 index 0000000000..cd88a5eee0 --- /dev/null +++ b/tur/opendylan/0002-fix-warning-as-error.patch @@ -0,0 +1,12 @@ +diff --git a/sources/jamfiles/posix-build.jam b/sources/jamfiles/posix-build.jam +index 47b798368..0d878f54f 100644 +--- a/sources/jamfiles/posix-build.jam ++++ b/sources/jamfiles/posix-build.jam +@@ -53,6 +53,7 @@ OBJCOPY ?= objcopy ; + STRIP ?= strip ; + + CCFLAGS += -fPIC ; ++echo $(CCFLAGS) ; + + LINK ?= $(CC) ; + UNIFYLINK ?= $(CC) -Bstatic ; diff --git a/tur/opendylan/0003-disable-fpu_control-related-functions.patch b/tur/opendylan/0003-disable-fpu_control-related-functions.patch new file mode 100644 index 0000000000..6db38a8f3c --- /dev/null +++ b/tur/opendylan/0003-disable-fpu_control-related-functions.patch @@ -0,0 +1,50 @@ +diff --git a/sources/lib/run-time/x86-linux-exceptions.c b/sources/lib/run-time/x86-linux-exceptions.c +index 0c4150a1e..7bda60f2b 100644 +--- a/sources/lib/run-time/x86-linux-exceptions.c ++++ b/sources/lib/run-time/x86-linux-exceptions.c +@@ -10,7 +10,9 @@ + #include + #include + #include ++#ifndef __ANDROID__ + #include ++#endif + + #include "stack-walker.h" + +@@ -46,11 +48,15 @@ extern void dylan_float_underflow_handler(); + /* FPU Control Word mask enabling exceptions for divide-by-zero, + * invalid, overflow, and underflow + */ ++#ifndef __ANDROID__ + #define DYLAN_FPU_CW (_FPU_DEFAULT \ + & ~(_FPU_MASK_ZM \ + | _FPU_MASK_IM \ + | _FPU_MASK_OM \ + | _FPU_MASK_UM)) ++#else ++#define DYLAN_FPU_CW 0 ++#endif + + static inline void chain_sigaction(const struct sigaction *act, + int sig, siginfo_t *info, void *uap) +@@ -159,7 +165,9 @@ static void EstablishDylanExceptionHandlers(void) + + /* Set the FPU control word */ + cw = DYLAN_FPU_CW; ++ #ifndef __ANDROID__ + _FPU_SETCW(cw); ++ #endif + } + + static void RemoveDylanExceptionHandlers (void) +@@ -176,7 +184,9 @@ void RestoreFPState (ucontext_t *uc) + if (uc->uc_mcontext.fpregs) { + uc->uc_mcontext.fpregs->cw = cw; + } ++ #ifndef __ANDROID__ + _FPU_SETCW(cw); ++ #endif + } + + static void DylanFPEHandler (int sig, siginfo_t *info, void *uap) diff --git a/tur/opendylan/0004-predefine-system-install-path.patch b/tur/opendylan/0004-predefine-system-install-path.patch new file mode 100644 index 0000000000..a4534e15f1 --- /dev/null +++ b/tur/opendylan/0004-predefine-system-install-path.patch @@ -0,0 +1,20 @@ +diff --git a/sources/lib/build-system/variables.dylan b/sources/lib/build-system/variables.dylan +index 47a31dab4..c9fc62b92 100644 +--- a/sources/lib/build-system/variables.dylan ++++ b/sources/lib/build-system/variables.dylan +@@ -12,14 +12,12 @@ define variable $personal-bin :: false-or() = #f; + + // We don't ensure system directories because nothing is installed there. + // By definition they had to have been already created +-define variable $system-install :: false-or() = #f; ++define variable $system-install :: false-or() = as(, "@TERMUX_PREFIX@"); + + define method configure-build-system () => () + $personal-install := user-install-path(); + $personal-bin := + $personal-install & subdirectory-locator($personal-install, "bin"); +- +- $system-install := system-install-path() | system-release-path(); + end method; + + configure-build-system(); diff --git a/tur/opendylan/android-build.jam.patch b/tur/opendylan/android-build.jam.patch new file mode 100644 index 0000000000..b0d7eb4248 --- /dev/null +++ b/tur/opendylan/android-build.jam.patch @@ -0,0 +1,14 @@ +diff --git a/android-build.jam b/android-build.jam +new file mode 100644 +index 000000000..9fe529f17 +--- /dev/null ++++ b/android-build.jam +@@ -0,0 +1,8 @@ ++CC = @CC@ ; ++CCFLAGS = @CFLAGS@ ; ++LINK = @CC@ ; ++LINKFLAGS = @LDFLAGS@ ; ++GC_CFLAGS = -DGC_USE_BOEHM -DGC_THREADS ; ++GC_LFLAGS = -lgc ; ++ ++include $(SYSTEM_BUILD_SCRIPTS)/@ARCH@-linux-build.jam ; diff --git a/tur/opendylan/build.sh b/tur/opendylan/build.sh new file mode 100644 index 0000000000..9b440a5529 --- /dev/null +++ b/tur/opendylan/build.sh @@ -0,0 +1,60 @@ +TERMUX_PKG_HOMEPAGE=https://opendylan.org +TERMUX_PKG_DESCRIPTION="Open Dylan is a compiler and a set of libraries for the Dylan programming language." +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="License.txt" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION=2024.1.0 +TERMUX_PKG_SRCURL=git+https://github.com/dylan-lang/opendylan +TERMUX_PKG_DEPENDS="libgc" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--with-gc=${TERMUX_PREFIX} +--with-harp-collector=boehm +" + +termux_step_pre_configure() { + curl -Lo "${TERMUX_PKG_CACHEDIR}/opendylan.tar.bz2" https://github.com/dylan-lang/opendylan/releases/download/v2024.1.0/opendylan-2024.1-x86_64-linux.tar.bz2 + tar -xf "${TERMUX_PKG_CACHEDIR}/opendylan.tar.bz2" -C "${TERMUX_PKG_CACHEDIR}" + export PATH="$PATH:${TERMUX_PKG_CACHEDIR}/opendylan-2024.1/bin" + + find "${TERMUX_PKG_CACHEDIR}/opendylan-2024.1" -name '*.jam' -type f -exec \ + sed -i \ + -e 's/-lrt//g' \ + -e 's/-lpthread//g' \ + {} \; + + case "${TARGET_ARCH:=${TERMUX_ARCH}}" in + i686) TARGET_ARCH=x86 ;; + esac + export OPEN_DYLAN_TARGET_PLATFORM="${TARGET_ARCH}-linux" + + CFLAGS+=" -Wno-error=int-conversion -femulated-tls" + LDFLAGS+=" -Wl,-plugin-opt=-emulated-tls=1" + + sed -i \ + -e "s|@CC@|${CC}|g" \ + -e "s|@CFLAGS@|${CPPFLAGS} ${CFLAGS}|g" \ + -e "s|@LDFLAGS@|${LDFLAGS}|g" \ + -e "s|@ARCH@|${TARGET_ARCH}|g" \ + "${TERMUX_PKG_SRCDIR}/android-build.jam" + + ./autogen.sh +} + +termux_step_make() { + make -j "${TERMUX_PKG_MAKE_PROCESSES}" -C "sources/lib/run-time" clean install \ + CC="${CC} ${CFLAGS}" \ + OPEN_DYLAN_TARGET_PLATFORM="${OPEN_DYLAN_TARGET_PLATFORM}" \ + OPEN_DYLAN_USER_INSTALL="${TERMUX_PREFIX}" + + dylan-compiler \ + -jobs "${TERMUX_PKG_MAKE_PROCESSES}" \ + -back-end c \ + -build-script "${TERMUX_PKG_SRCDIR}/android-build.jam" \ + -release \ + -verbose \ + -echo-input \ + -build sources/environment/console/dylan-compiler.lid + + find ./_build +} diff --git a/tur/opendylan/sources-jamfiles-config.jam.in.patch b/tur/opendylan/sources-jamfiles-config.jam.in.patch new file mode 100644 index 0000000000..3608704679 --- /dev/null +++ b/tur/opendylan/sources-jamfiles-config.jam.in.patch @@ -0,0 +1,25 @@ +diff --git a/sources/jamfiles/config.jam.in b/sources/jamfiles/config.jam.in +index 978b5c87f..613bdef40 100644 +--- a/sources/jamfiles/config.jam.in ++++ b/sources/jamfiles/config.jam.in +@@ -2,14 +2,14 @@ + # This Jam file is generated by the configure script + # + +-SUPPORTED_COMPILER_BACK_ENDS ?= @SUPPORTED_COMPILER_BACK_ENDS@ ; ++SUPPORTED_COMPILER_BACK_ENDS = @SUPPORTED_COMPILER_BACK_ENDS@ ; + +-CC ?= @CC@ ; +-CCFLAGS ?= @DISABLE_WARNINGS_CFLAGS@ @CFLAGS@ ; +-C++ ?= @CXX@ ; +-C++FLAGS ?= $(CCFLAGS) ; ++CC = @CC@ ; ++CCFLAGS = -w -Wno-error=int-conversion @CFLAGS@ ; ++C++ = @CXX@ ; ++C++FLAGS = $(CCFLAGS) ; + +-LIBS ?= @LIBS@ ; ++LIBS = @LIBS@ ; + + RTLIBS_INSTALL ?= ; + diff --git a/tur/opendylan/sources-jamfiles-posix-build.jam.patch b/tur/opendylan/sources-jamfiles-posix-build.jam.patch new file mode 100644 index 0000000000..4c208f7524 --- /dev/null +++ b/tur/opendylan/sources-jamfiles-posix-build.jam.patch @@ -0,0 +1,13 @@ +diff --git a/sources/jamfiles/posix-build.jam b/sources/jamfiles/posix-build.jam +index 47b798368..50f468ac6 100644 +--- a/sources/jamfiles/posix-build.jam ++++ b/sources/jamfiles/posix-build.jam +@@ -56,7 +56,7 @@ CCFLAGS += -fPIC ; + + LINK ?= $(CC) ; + UNIFYLINK ?= $(CC) -Bstatic ; +-LINKFLAGS ?= $(CCFLAGS) ; ++LINKFLAGS = $(CCFLAGS) -Wno-error=int-conversion ; + + # + # Runtime