diff --git a/buildenv b/buildenv index ca4a527..51cf2b0 100644 --- a/buildenv +++ b/buildenv @@ -156,7 +156,7 @@ export ZOPEN_EXTRA_LIBS="-lffi" ## C,C++ libraries to append to LIBS (defaults t #export ZOPEN_CLEAN_OPTS="" ## Options to pass to clean up program (defaults to 'clean') #export ZOPEN_CONFIGURE_MINIMAL="" ## Configuration program will not be passed CFLAGS, LDFLAGS, CPPFLAGS options but will get them from env vars. #export ZOPEN_CONFIGURE_OPTS="" ## Options to pass to configuration program (defaults to '--prefix=') -export ZOPEN_EXTRA_CONFIGURE_OPTS="--disable-shared --disable-dln --disable-yjit --disable-rjit --without-valgrind --with-static-linked-ext" ## Extra configure options to pass to configuration program. (defaults to '') +export ZOPEN_EXTRA_CONFIGURE_OPTS="--disable-shared --disable-dln --disable-yjit --disable-rjit --without-valgrind --with-static-linked-ext=yes --enable-load-relative" ## Extra configure options to pass to configuration program. (defaults to '') #export ZOPEN_INSTALL_OPTS="" ## Options to pass to installation program (defaults to 'install') export ZOPEN_MAKE_MINIMAL="yes" ## Build program will not be passed CFLAGS, LDFLAGS, CPPFLAGS options but will get them from env vars. #export ZOPEN_MAKE_OPTS="" ## Options to pass to build program (defaults to '-j') diff --git a/patches/configure.patch b/patches/configure.patch index 2fbdcd0..909ad6e 100644 --- a/patches/configure.patch +++ b/patches/configure.patch @@ -1,5 +1,5 @@ diff --git a/configure b/configure -index 7a391a2..02c7c41 100755 +index 7a391a2..cb427d0 100755 --- a/configure +++ b/configure @@ -26423,6 +26423,7 @@ if test "x$ac_cv_func_fork_works" = xcross; then @@ -35,3 +35,16 @@ index 7a391a2..02c7c41 100755 dir=-1 ;; #( hppa*) : dir=+1 ;; #( +@@ -31665,6 +31668,12 @@ fi + + SOEXT=dylib + DLEXT=bundle ;; #( ++ openedition*) : ++ if test "$load_relative" = yes; then ++ LOAD_RELATIVE=1 ++ fi ++ SOEXT=so ++ DLEXT=so ;; #( + cygwin*|msys*|mingw*|*djgpp*) : + + LOAD_RELATIVE=1 diff --git a/patches/ruby.c.patch b/patches/ruby.c.patch new file mode 100644 index 0000000..28ad7a3 --- /dev/null +++ b/patches/ruby.c.patch @@ -0,0 +1,45 @@ +diff --git a/ruby.c b/ruby.c +index d2c168c..d097151 100644 +--- a/ruby.c ++++ b/ruby.c +@@ -26,6 +26,10 @@ + # include + #endif + ++#if defined(LOAD_RELATIVE) && defined(__MVS__) ++#include ++#endif ++ + #ifdef HAVE_UNISTD_H + # include + #endif +@@ -656,6 +660,29 @@ runtime_libruby_path(void) + } + rb_str_resize(fname, 0); + return path; ++#elif defined(__MVS__) ++ int token = 0; ++ W_PSPROC buf; ++ char exe_path[PS_PATHBLEN]; ++ pid_t pid = getpid(); ++ ++ memset(&buf, 0, sizeof(buf)); ++ buf.ps_pathptr = exe_path; ++ buf.ps_pathlen = sizeof(exe_path); ++ ++ while (1) { ++ if ((token = w_getpsent(token, &buf, sizeof(buf))) <= 0) ++ break; ++ if (buf.ps_pid != pid) ++ continue; ++ char real_path[PATH_MAX]; ++ if (realpath(exe_path, real_path)) ++ { ++ return rb_str_new_cstr(real_path); ++ } ++ break; // Found entry, but realpath failed. ++ } ++ rb_fatal("failed to get executable path on z/OS"); + #else + # error relative load path is not supported on this platform. + #endif diff --git a/patches/thread_pthread.c.patch b/patches/thread_pthread.c.patch index 0273540..5e044dd 100644 --- a/patches/thread_pthread.c.patch +++ b/patches/thread_pthread.c.patch @@ -1,5 +1,5 @@ diff --git a/thread_pthread.c b/thread_pthread.c -index 423814c..42992d5 100644 +index 423814c..e38c4bf 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -2022,7 +2022,7 @@ native_thread_init_stack(rb_thread_t *th, void *local_in_parent_frame) @@ -11,3 +11,12 @@ index 423814c..42992d5 100644 /* This thread is the first thread, must be the main thread - * configure the native_main_thread object */ native_thread_init_main_thread_stack(local_in_parent_frame); +@@ -2045,7 +2045,7 @@ native_thread_init_stack(rb_thread_t *th, void *local_in_parent_frame) + } + } + #else +- rb_raise(rb_eNotImpError, "ruby engine can initialize only in the main thread"); ++ //rb_raise(rb_eNotImpError, "ruby engine can initialize only in the main thread"); + #endif + } +