Skip to content

Commit

Permalink
newpkg(tur/opendylan): 2024.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mbekkomo committed Jul 3, 2024
1 parent ac55e86 commit 127e05c
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tur/opendylan/0001-fix-linking.patch
Original file line number Diff line number Diff line change
@@ -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 ;
12 changes: 12 additions & 0 deletions tur/opendylan/0002-fix-warning-as-error.patch
Original file line number Diff line number Diff line change
@@ -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 ;
50 changes: 50 additions & 0 deletions tur/opendylan/0003-disable-fpu_control-related-functions.patch
Original file line number Diff line number Diff line change
@@ -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 <signal.h>
#include <sys/ucontext.h>
#include <ucontext.h>
+#ifndef __ANDROID__
#include <fpu_control.h>
+#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)
20 changes: 20 additions & 0 deletions tur/opendylan/0004-predefine-system-install-path.patch
Original file line number Diff line number Diff line change
@@ -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(<directory-locator>) = #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(<directory-locator>) = #f;
+define variable $system-install :: false-or(<directory-locator>) = as(<directory-locator>, "@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();
14 changes: 14 additions & 0 deletions tur/opendylan/android-build.jam.patch
Original file line number Diff line number Diff line change
@@ -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)/@[email protected] ;
60 changes: 60 additions & 0 deletions tur/opendylan/build.sh
Original file line number Diff line number Diff line change
@@ -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 -fno-emulated-tls"
LDFLAGS+=" -Wl,-plugin-opt=-emulated-tls=0"

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
}
25 changes: 25 additions & 0 deletions tur/opendylan/sources-jamfiles-config.jam.in.patch
Original file line number Diff line number Diff line change
@@ -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 ?= ;

13 changes: 13 additions & 0 deletions tur/opendylan/sources-jamfiles-posix-build.jam.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 127e05c

Please sign in to comment.