Hi Antoine,

  Currently I'm struck with libunwind's dependency, which is needed to 
produce backtraces. I have forked the repository and am working towards 
making the code compile, but the task is hard because of the many low-level 
processing the library has to do. Have a look 
here: https://github.com/ziotom78/libunwind/tree/openbsd

Regarding julia, there are a number of changes I've not put on GitHub yet, 
as they are not polished yet. I am attaching a patch file which shows my 
changes with respect to the current state of Julia's master on GitHub 
(commit 081170435dad70bcaa6a5a80ef1d926ca2ef987d).

If you look above, you'll find a post of mine where I detail which ports 
you need and which flag to pass to "gmake".

Hope my bits are clear, if you need help just ask.
  Maurizio.

On Monday, September 14, 2015 at 3:13:01 PM UTC+2, Antoine Jardin wrote:
>
> I intend to install openbsd on my x230 for the purpose of trying to port 
> julia.
>
> Maurizio, have you documented the steps you took to get where you are ? 
>
> Were you using -release or -current ? 
>
> Thanks for your work ! 
>
> Best, 
>
> Antoine
>
diff --git a/Makefile b/Makefile
index 373ac70..d8c0862 100644
--- a/Makefile
+++ b/Makefile
@@ -293,11 +293,11 @@ ifeq ($(OS),WINNT)
 	-$(INSTALL_M) $(build_libdir)/libjulia.dll.a $(DESTDIR)$(libdir)/
 	-$(INSTALL_M) $(build_libdir)/libjulia-debug.dll.a $(DESTDIR)$(libdir)/
 else
-	-cp -a $(build_libexecdir) $(DESTDIR)$(prefix)
+	-cp -RPp $(build_libexecdir) $(DESTDIR)$(prefix)
 
 	# Copy over .dSYM directories directly
 ifeq ($(OS),Darwin)
-	-cp -a $(build_libdir)/*.dSYM $(DESTDIR)$(private_libdir)
+	-cp -RPp $(build_libdir)/*.dSYM $(DESTDIR)$(private_libdir)
 endif
 
 	for suffix in $(JL_LIBS) ; do \
diff --git a/deps/Makefile b/deps/Makefile
index 2a49983..6740948 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -89,6 +89,8 @@ endif
 ifeq ($(USE_SYSTEM_LIBUNWIND), 0)
 ifeq ($(OS), Linux)
 STAGE1_DEPS += unwind
+else ifeq ($(OS), OpenBSD)
+STAGE1_DEPS += unwind
 else ifeq ($(OS), FreeBSD)
 STAGE1_DEPS += unwind
 else ifeq ($(OS), Darwin)
@@ -220,7 +222,7 @@ define staged-install
 	rm -rf $(build_staging)/$1
 	$2
 	mkdir -p $(build_prefix)
-	cp -af $(build_staging)/$1$(build_prefix)/* $(build_prefix)
+	cp -RPpf $(build_staging)/$1$(build_prefix)/* $(build_prefix)
 endef
 
 define make-install
@@ -829,7 +831,7 @@ install-pcre: $(PCRE_OBJ_TARGET)
 
 
 ## openlibm ##
-OPENLIBM_GIT_URL = git://github.com/JuliaLang/openlibm.git
+OPENLIBM_GIT_URL = /home/tomasi/openlibm
 OPENLIBM_TAR_URL = https://api.github.com/repos/JuliaLang/openlibm/tarball/$1
 $(eval $(call git-external,openlibm,OPENLIBM,Makefile,libopenlibm.$(SHLIB_EXT)))
 
@@ -958,7 +960,7 @@ RMATH_JULIA_FLAGS += CC="$(CC)" USECLANG=$(USECLANG) USEGCC=$(USEGCC) \
 			   DSFMT_includedir="$(build_includedir)"
 
 Rmath-julia-$(RMATH_JULIA_VER).tar.gz:
-	$(JLDOWNLOAD) $@ https://api.github.com/repos/JuliaLang/Rmath-julia/tarball/v$(RMATH_JULIA_VER)
+	$(JLDOWNLOAD) $@ https://github.com/ziotom78/Rmath-julia/archive/v0.2.tar.gz
 $(RMATH_JULIA_OBJ_SOURCE): Rmath-julia-$(RMATH_JULIA_VER).tar.gz
 	$(JLCHECKSUM) Rmath-julia-$(RMATH_JULIA_VER).tar.gz && \
 	mkdir -p Rmath-julia-$(RMATH_JULIA_VER) && \
diff --git a/deps/Versions.make b/deps/Versions.make
index b735d8f..858490f 100644
--- a/deps/Versions.make
+++ b/deps/Versions.make
@@ -13,4 +13,4 @@ MPFR_VER=3.1.2
 PATCHELF_VER = 0.8
 GIT_VER = 1.8.5.6
 VIRTUALENV_VER = 1.11.6
-RMATH_JULIA_VER = 0.1
+RMATH_JULIA_VER = 0.2
diff --git a/deps/openlibm.version b/deps/openlibm.version
index 4e42351..7ac8ce9 100644
--- a/deps/openlibm.version
+++ b/deps/openlibm.version
@@ -1,2 +1,2 @@
-OPENLIBM_BRANCH=v0.4.1
+OPENLIBM_BRANCH=master
 OPENLIBM_SHA1=3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06
diff --git a/src/ccall.cpp b/src/ccall.cpp
index 76cdd15..94445df 100644
--- a/src/ccall.cpp
+++ b/src/ccall.cpp
@@ -5,7 +5,7 @@
 // --- library symbol lookup ---
 
 // map from "libX" to full soname "libX.so.ver"
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 static std::map<std::string, std::string> sonameMap;
 static bool got_sonames = false;
 
diff --git a/src/flisp/Makefile b/src/flisp/Makefile
index bec8624..fb2f1a1 100644
--- a/src/flisp/Makefile
+++ b/src/flisp/Makefile
@@ -30,6 +30,9 @@ LIBS =
 ifneq ($(OS),WINNT)
 LIBS += -lpthread
 endif
+ifeq ($(OS),OpenBSD)
+LIBS += -lkvm
+endif
 
 FLAGS = -I$(LLTDIR) $(CFLAGS) $(HFILEDIRS:%=-I%) \
         -I$(LIBUV_INC) -I$(build_includedir) $(LIBDIRS:%=-L%) \
diff --git a/src/signal-handling.c b/src/signal-handling.c
index 1319d04..5a0a380 100644
--- a/src/signal-handling.c
+++ b/src/signal-handling.c
@@ -54,7 +54,7 @@ static void *signal_stack;
 static int is_addr_on_stack(void *addr);
 #ifdef __APPLE__
 #include "signals-apple.c"
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
 #include "signals-bsd.c"
 #else
 #include "signals-linux.c"
diff --git a/src/support/END.h b/src/support/END.h
index 84e0dc6..aa2b94d 100644
--- a/src/support/END.h
+++ b/src/support/END.h
@@ -33,7 +33,7 @@
  * $FreeBSD: src/sys/i386/include/asm.h,v 1.14 2007/08/22 04:26:07 jkoshy Exp $
  */
 
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__) || defined(__OpenBSD__)
 .size CNAME, . - CNAME
 #else
 #ifndef _MSC_VER
diff --git a/src/support/ENTRY.amd64.h b/src/support/ENTRY.amd64.h
index a3419e8..89b1fd2 100644
--- a/src/support/ENTRY.amd64.h
+++ b/src/support/ENTRY.amd64.h
@@ -36,7 +36,7 @@
 #define _START_ENTRY .p2align 4,0x90
 #define STR(csym)           #csym
 #define XSTR(csym)          STR(csym)
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__) || defined(__OpenBSD__)
 #ifndef __APPLE__
 #define EXT_(csym)          csym
 #define EXT(csym)           EXT_(csym)
diff --git a/src/support/dtypes.h b/src/support/dtypes.h
index 4568315..9790135 100644
--- a/src/support/dtypes.h
+++ b/src/support/dtypes.h
@@ -77,7 +77,7 @@
 #define BYTE_ORDER     __BYTE_ORDER
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 #include <machine/endian.h>
 #define __LITTLE_ENDIAN  LITTLE_ENDIAN
 #define __BIG_ENDIAN     BIG_ENDIAN
diff --git a/src/support/platform.h b/src/support/platform.h
index 058ed0d..ee3aeff 100644
--- a/src/support/platform.h
+++ b/src/support/platform.h
@@ -67,6 +67,8 @@
 #define _OS_WINDOWS_
 #elif defined(__APPLE__) && defined(__MACH__)
 #define _OS_DARWIN_
+#elif defined(__OpenBSD__)
+#define _OS_OPENBSD_
 #endif
 
 /*******************************************************************************
diff --git a/src/support/strtod.c b/src/support/strtod.c
index 2d6b1f2..e76e4c9 100644
--- a/src/support/strtod.c
+++ b/src/support/strtod.c
@@ -11,7 +11,7 @@
 extern "C" {
 #endif
 
-#if !defined(_OS_WINDOWS_)
+#if !defined(_OS_WINDOWS_) && !defined(__OpenBSD__)
 // This code path should be used for systems that support the strtod_l function
 
 // Cache locale object
diff --git a/src/support/utf8.c b/src/support/utf8.c
index 4a5e60a..b613df6 100644
--- a/src/support/utf8.c
+++ b/src/support/utf8.c
@@ -29,7 +29,7 @@
 #include <malloc.h>
 #define snprintf _snprintf
 #else
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
 #include <alloca.h>
 #endif /* __FreeBSD__ */
 #endif
diff --git a/src/sys.c b/src/sys.c
index 1953f06..aa9443a 100644
--- a/src/sys.c
+++ b/src/sys.c
@@ -666,6 +666,11 @@ DLLEXPORT const char *jl_pathname_for_handle(uv_lib_t *uv_lib)
     free(pth16);
     return filepath;
 
+#elif __OpenBSD__
+    Dl_info info;
+    dladdr(handle, &info);
+    return info.dli_fname;
+
 #else // Linux, FreeBSD, ...
 
     struct link_map *map;
@@ -726,6 +731,8 @@ DLLEXPORT jl_sym_t* jl_get_OS_NAME()
     return jl_symbol("Linux");
 #elif defined(_OS_FREEBSD_)
     return jl_symbol("FreeBSD");
+#elif defined(_OS_OPENBSD_)
+    return jl_symbol("OpenBSD");
 #elif defined(_OS_DARWIN_)
     return jl_symbol("Darwin");
 #else

Reply via email to