From f88850d6ead498cd60924dd751d4be8f5d15d094 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 29 Aug 2017 12:31:57 +0100 Subject: [PATCH] Changes to support OpenBSD --- README.md | 13 +++++++++++-- autogen.sh | 5 +++++ src/cgen.c | 2 +- tools/fetch-ieee.sh | 9 ++++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a67b2d9..f564bfac 100644 --- a/README.md +++ b/README.md @@ -89,12 +89,21 @@ To build from source follow the generic instructions above. Windows support is via [Cygwin](http://www.cygwin.com/). Use `setup.exe` to install either `gcc` or `clang` and the following dependencies: `automake`, `autoconf`, -`pkg-config`, `llvm`, `libllvm-devel`, `flex`, `libffi-devel`, `libcurses-devel`, `curl`, +`pkg-config`, `llvm`, `libllvm-devel`, `flex`, `libffi-devel`, `libcurses-devel`, `curl`, and `make`. Then follow the standard installation instructions above. #### OpenBSD -TODO +Install the dependencies with `pkg_add`: + + pkg_add -r llvm libexecinfo autoconf automake + +Use a modern compiler such as Clang to build, as the system GCC does not support many modern +language features. + + ./configure --with-llvm=/usr/local/bin/llvm-config CC=clang CXX=clang++ + +Then follow the generic instructions above. #### IEEE Libraries diff --git a/autogen.sh b/autogen.sh index 2caa76ab..f03a6397 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,3 +1,8 @@ #!/bin/sh + +# Required for OpenBSD +export AUTOCONF_VERSION=2.69 +export AUTOMAKE_VERSION=1.15 + cd $(git rev-parse --show-toplevel) autoreconf --force --install -I m4 diff --git a/src/cgen.c b/src/cgen.c index 16f4d3fd..1978c07b 100644 --- a/src/cgen.c +++ b/src/cgen.c @@ -3728,7 +3728,7 @@ static void cgen_native(tree_t top) LLVMCreateTargetMachine(target_ref, def_triple, "", "", LLVMCodeGenLevelDefault, LLVMRelocPIC, - LLVMCodeModelJITDefault); + LLVMCodeModelDefault); char *obj_name LOCAL = xasprintf("_%s." LLVM_OBJ_EXT, istr(tree_ident(top))); diff --git a/tools/fetch-ieee.sh b/tools/fetch-ieee.sh index 6bc1bd07..e4c2d188 100755 --- a/tools/fetch-ieee.sh +++ b/tools/fetch-ieee.sh @@ -21,7 +21,14 @@ download_file() { # download curl -sSL -o "$bn" "$url" # shasum - check=$(shasum -a 256 "$bn" | awk '{ print $1 }') +case `uname` in + OpenBSD) + check=$(sha256 -q "$bn") + ;; + *) + check=$(shasum -a 256 "$bn" | awk '{ print $1 }') + ;; + esac echo "$bn" -- 2.39.2