mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 03:23:09 +03:00
build: resurrect the openbsd build
This commit is contained in:
parent
1c6feb7b0f
commit
c42b1f679e
18
nix/sources-openssl.json
Normal file
18
nix/sources-openssl.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"openssl": {
|
||||
"branch": "1_1_1n",
|
||||
"homepage": "https://www.openssl.org/",
|
||||
"pmnsh": {
|
||||
"include": "build/include",
|
||||
"lib": "build",
|
||||
"prepare": "./config --prefix=`mkdir -p build && readlink -f ./build` --libdir=. no-shared no-tests",
|
||||
"make": "install_dev"
|
||||
},
|
||||
"owner": "openssl",
|
||||
"repo": "openssl",
|
||||
"rev": "OpenSSL_1_1_1n",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1n.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/refs/tags/<rev>.tar.gz"
|
||||
}
|
||||
}
|
@ -4,6 +4,11 @@
|
||||
"description": "A command line tool and library for transferring data with URL syntax",
|
||||
"homepage": "http://curl.se/",
|
||||
"pmnsh": {
|
||||
"compat": {
|
||||
"openbsd": {
|
||||
"prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl=`readlink -f ../openssl/build`"
|
||||
}
|
||||
},
|
||||
"include": "include",
|
||||
"lib": "lib/.libs",
|
||||
"prepare": "autoreconf -vfi && ./configure --disable-shared --disable-ldap --disable-rtsp --without-brotli --without-libidn2 --without-libpsl --without-nghttp2 --with-openssl",
|
||||
@ -76,6 +81,13 @@
|
||||
},
|
||||
"urcrypt": {
|
||||
"pmnsh": {
|
||||
"compat": {
|
||||
"openbsd": {
|
||||
"make": "install prefix=`readlink -f .` exec_prefix=`readlink -f .`",
|
||||
"include": "include",
|
||||
"lib": "lib"
|
||||
}
|
||||
},
|
||||
"prepare": "./autogen.sh && ./configure --disable-shared PKG_CONFIG_PATH=../secp256k1 CFLAGS=\"-I../secp256k1/include -I../libaes_siv\" LDFLAGS=-L../libaes_siv",
|
||||
"make": "install"
|
||||
}
|
||||
|
@ -8,6 +8,9 @@
|
||||
"compat": {
|
||||
"mingw": {
|
||||
"prepare": "cmake -G\"MSYS Makefiles\" -DCMAKE_INSTALL_PREFIX=. ."
|
||||
},
|
||||
"openbsd": {
|
||||
"prepare": "cmake -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ."
|
||||
}
|
||||
},
|
||||
"include": "include",
|
||||
@ -35,6 +38,10 @@
|
||||
"mingw": {
|
||||
"make": "aes_siv_static",
|
||||
"prepare": "cmake -G\"MSYS Makefiles\" -DDISABLE_DOCS:BOOL=ON ."
|
||||
},
|
||||
"openbsd": {
|
||||
"make": "aes_siv_static",
|
||||
"prepare": "cmake -DDISABLE_DOCS:BOOL=ON -DOPENSSL_ROOT_DIR=`readlink -f ../openssl/build` ."
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -98,6 +105,10 @@
|
||||
"mingw": {
|
||||
"lib": "build/Win64-MinGW-w64",
|
||||
"make": "-C build/Win64-MinGW-w64 libsoftfloat3.a"
|
||||
},
|
||||
"openbsd": {
|
||||
"lib": "build/template-FAST_INT64",
|
||||
"make": "-C build/template-FAST_INT64 libsoftfloat3.a"
|
||||
}
|
||||
},
|
||||
"include": "source/include"
|
||||
|
12
pkg/urbit/compat/openbsd/ent.patch
Normal file
12
pkg/urbit/compat/openbsd/ent.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/configure b/configure
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
log "Trying IMPL=$IMPL"
|
||||
|
||||
- if IMPL=$impl make >/dev/null 2>/dev/null
|
||||
+ if IMPL=$impl gmake >/dev/null 2>/dev/null
|
||||
then sed -i 's|$(error IMPL must be set)|IMPL='"$impl"'|' Makefile
|
||||
log "IMPL=$IMPL works"
|
||||
exit 0
|
12
pkg/urbit/compat/openbsd/lmdb.patch
Normal file
12
pkg/urbit/compat/openbsd/lmdb.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -18,7 +18,7 @@
|
||||
# There may be other macros in mdb.c of interest. You should
|
||||
# read mdb.c before changing any of them.
|
||||
#
|
||||
-CC = gcc
|
||||
+CC = cc
|
||||
AR = ar
|
||||
W = -W -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized
|
||||
THREADS = -pthread
|
13
pkg/urbit/compat/openbsd/murmur3.patch
Normal file
13
pkg/urbit/compat/openbsd/murmur3.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/makefile b/makefile
|
||||
--- a/makefile
|
||||
+++ b/makefile
|
||||
@@ -12,5 +12,9 @@ shared: murmur3.c murmur3.h
|
||||
$(CC) -fPIC -O3 -c murmur3.c
|
||||
$(CC) -shared -Wl,--export-dynamic murmur3.o -o libmurmur3.so
|
||||
|
||||
+static: murmur3.c murmur3.h
|
||||
+ $(CC) -fPIC -O3 -c murmur3.c
|
||||
+ $(AR) rcs libmurmur3.a murmur3.o
|
||||
+
|
||||
clean:
|
||||
rm -rf example *.o *.so
|
85
pkg/urbit/compat/openbsd/softfloat3.patch
Normal file
85
pkg/urbit/compat/openbsd/softfloat3.patch
Normal file
@ -0,0 +1,85 @@
|
||||
diff --git a/build/template-FAST_INT64/Makefile b/build/template-FAST_INT64/Makefile
|
||||
--- a/build/template-FAST_INT64/Makefile
|
||||
+++ b/build/template-FAST_INT64/Makefile
|
||||
@@ -34,28 +34,27 @@
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
-# Edit lines marked with `==>'. See "SoftFloat-source.html".
|
||||
+SOURCE_DIR ?= ../../source
|
||||
+SPECIALIZE_TYPE ?= 8086-SSE
|
||||
|
||||
-==> SOURCE_DIR ?= ../../source
|
||||
-==> SPECIALIZE_TYPE ?= 8086
|
||||
+SOFTFLOAT_OPTS ?= \
|
||||
+ -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 \
|
||||
+ -DSOFTFLOAT_FAST_DIV64TO32
|
||||
|
||||
-==> SOFTFLOAT_OPTS ?= \
|
||||
-==> -DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 \
|
||||
-==> -DSOFTFLOAT_FAST_DIV64TO32
|
||||
+DELETE = rm -f
|
||||
+C_INCLUDES = -I. -I$(SOURCE_DIR)/$(SPECIALIZE_TYPE) -I$(SOURCE_DIR)/include
|
||||
+COMPILE_C = \
|
||||
+ cc -c -DSOFTFLOAT_FAST_INT64 $(SOFTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@
|
||||
+MAKELIB = ar crs $@
|
||||
+LIBNAME = libsoftfloat3
|
||||
|
||||
-==> DELETE = rm -f
|
||||
-==> C_INCLUDES = -I. -I$(SOURCE_DIR)/$(SPECIALIZE_TYPE) -I$(SOURCE_DIR)/include
|
||||
-==> COMPILE_C = \
|
||||
-==> cc -c -DSOFTFLOAT_FAST_INT64 $(SOFTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@
|
||||
-==> MAKELIB = ar crs $@
|
||||
+OBJ = .o
|
||||
+LIB = .a
|
||||
|
||||
-==> OBJ = .o
|
||||
-==> LIB = .a
|
||||
-
|
||||
-==> OTHER_HEADERS =
|
||||
+OTHER_HEADERS =
|
||||
|
||||
.PHONY: all
|
||||
-all: softfloat$(LIB)
|
||||
+all: $(LIBNAME)$(LIB)
|
||||
|
||||
OBJS_PRIMITIVES = \
|
||||
s_eq128$(OBJ) \
|
||||
@@ -381,11 +380,11 @@ $(OBJS_PRIMITIVES) $(OBJS_OTHERS): %$(OBJ): $(SOURCE_DIR)/%.c
|
||||
$(OBJS_SPECIALIZE): %$(OBJ): $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/%.c
|
||||
$(COMPILE_C) $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/$*.c
|
||||
|
||||
-softfloat$(LIB): $(OBJS_ALL)
|
||||
+$(LIBNAME)$(LIB): $(OBJS_ALL)
|
||||
$(DELETE) $@
|
||||
$(MAKELIB) $^
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
- $(DELETE) $(OBJS_ALL) softfloat$(LIB)
|
||||
+ $(DELETE) $(OBJS_ALL) $(LIBNAME)$(LIB)
|
||||
|
||||
diff --git a/build/template-FAST_INT64/platform.h b/build/template-FAST_INT64/platform.h
|
||||
--- a/build/template-FAST_INT64/platform.h
|
||||
+++ b/build/template-FAST_INT64/platform.h
|
||||
@@ -34,17 +34,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
-// Edit lines marked with `==>'. See "SoftFloat-source.html".
|
||||
-
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
-==> #define LITTLEENDIAN 1
|
||||
+#define LITTLEENDIAN 1
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
-==> #define INLINE inline
|
||||
+#define INLINE inline
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*----------------------------------------------------------------------------*/
|
||||
-==> #define THREAD_LOCAL _Thread_local
|
||||
+#define THREAD_LOCAL
|
||||
|
@ -3,13 +3,18 @@ declare -a ldirs
|
||||
declare -a pdirs
|
||||
declare -A hdeps
|
||||
sources=(../../nix/sources.json ../../nix/sources-pmnsh.json)
|
||||
[ "yes" == "${build_openssl-no}" ] && sources=(../../nix/sources-openssl.json ${sources[@]})
|
||||
patches=compat/$1
|
||||
deriver=urbit-$1-build
|
||||
markfil=.$1~
|
||||
depdirs=
|
||||
nixpath=${NIX_STORE-../build}
|
||||
|
||||
: "${MAKE:=make}"
|
||||
: ${gnutar:=tar}
|
||||
: ${gnumake:=make}
|
||||
: ${sha256tool:=sha256sum}
|
||||
|
||||
export MAKE=$gnumake
|
||||
|
||||
# LDFLAGS doesn't like absolute paths
|
||||
if [ "${nixpath:0:1}" == "/" ]
|
||||
@ -71,7 +76,7 @@ buildnixdep () {
|
||||
fi
|
||||
mkdir -p $dir
|
||||
pushd $dir
|
||||
curl -fL "$url"|(tar --strip $strip -xzf - || true)
|
||||
curl -fL "$url"|($gnutar --strip $strip -xzf - || true)
|
||||
popd
|
||||
fi
|
||||
else
|
||||
@ -86,7 +91,7 @@ buildnixdep () {
|
||||
[ -e $patch ] && patch -d $dir -p 1 <$patch
|
||||
pushd $dir
|
||||
eval "$cmdprep"
|
||||
eval ${MAKE} "$cmdmake"
|
||||
eval $gnumake "$cmdmake"
|
||||
touch $markfil
|
||||
popd
|
||||
fi
|
||||
@ -98,13 +103,13 @@ buildnixdep () {
|
||||
echo Uploading freshly built $hash-$key to binary cache...
|
||||
tar -C $dir -czf $hash.tar .
|
||||
local size=$(stat -c '%s' $hash.tar)
|
||||
read filehash _ < <(sha256sum $hash.tar)
|
||||
read filehash _ < <($sha256tool $hash.tar)
|
||||
curl -fL -H "Content-Type: application/gzip" -H "Authorization: Bearer $CACHIX_AUTH_TOKEN" --data-binary @"$hash.tar" "$cache/nar"
|
||||
curl -fL -H "Content-Type: application/json" -H "Authorization: Bearer $CACHIX_AUTH_TOKEN" --data-binary @- "$cache/${hash}.narinfo" <<EOF
|
||||
{
|
||||
"cStoreHash": "$hash",
|
||||
"cStoreSuffix": "$key",
|
||||
"cNarHash": "sha256:$(hex2nixbase32 $filehash)",
|
||||
"cNarHash": "$sha256tool:$(hex2nixbase32 $filehash)",
|
||||
"cNarSize": $size,
|
||||
"cFileHash": "$filehash",
|
||||
"cFileSize": $size,
|
||||
@ -129,7 +134,7 @@ do
|
||||
patch=$patches/$key.patch
|
||||
read hash _ < <((
|
||||
echo -n $json
|
||||
[ -e $patch ] && cat $patch)|sha256sum)
|
||||
[ -e $patch ] && cat $patch)|$sha256tool)
|
||||
hash=$(hex2nixbase32 $hash)
|
||||
hdeps[$key]=$hash
|
||||
depdirs="$depdirs|gsub(\"\\\\.\\\\./$key\";\"\\(\$d)/$hash-$key\")"
|
||||
|
22
pkg/urbit/configure
vendored
22
pkg/urbit/configure
vendored
@ -85,7 +85,7 @@ case $(tr A-Z a-z <<< $cpu) in
|
||||
i686)
|
||||
defmacro U3_OS_ENDIAN_little 1
|
||||
;;
|
||||
x86_64)
|
||||
x86_64 | amd64)
|
||||
defmacro U3_OS_ENDIAN_little 1
|
||||
;;
|
||||
arm64|aarch64)
|
||||
@ -156,7 +156,27 @@ case $(tr A-Z a-z <<< $os) in
|
||||
deps="$deps kvm" # XX use new compat.mk pattern
|
||||
;;
|
||||
*openbsd*)
|
||||
# pkg_add bash automake libtool jq gtar cmake gmake libsigsegv
|
||||
# Tested versions:
|
||||
# bash-5.1.8 automake-1.16.3 (autoconf-2.69p3) libtool-2.4.2p2
|
||||
# jq-1.6p0 gtar-1.34-static cmake-3.20.3p0v0 gmake-4.3 libsigsegv-2.12
|
||||
|
||||
gnutar=gtar
|
||||
gnumake=gmake
|
||||
sha256tool=sha256
|
||||
build_openssl=yes
|
||||
export AUTOCONF_VERSION="${AUTOCONF_VERSION-2.69}"
|
||||
export AUTOMAKE_VERSION="${AUTOMAKE_VERSION-1.16}"
|
||||
. compat/poor-mans-nix-shell.sh openbsd
|
||||
compat/create-include-files.sh 'stat -f %z' /etc/ssl/cert.pem
|
||||
|
||||
defmacro U3_OS_bsd 1
|
||||
defmacro U3_OS_no_ubc 1
|
||||
|
||||
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH-}"
|
||||
deps="$deps aes_siv secp256k1"
|
||||
|
||||
compat="${compat-} posix openbsd"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown or unsupported OS: '$os'" >&2
|
||||
|
@ -65,12 +65,20 @@ u3_lmdb_init(const c3_c* pax_c, size_t siz_i)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (ret_w = mdb_env_open(env_u, pax_c, 0, 0664)) ) {
|
||||
{
|
||||
# if defined(U3_OS_no_ubc)
|
||||
c3_w ops_w = MDB_WRITEMAP;
|
||||
# else
|
||||
c3_w ops_w = 0;
|
||||
# endif
|
||||
|
||||
if ( (ret_w = mdb_env_open(env_u, pax_c, ops_w, 0664)) ) {
|
||||
mdb_logerror(stderr, ret_w, "lmdb: failed to open event log");
|
||||
// XX dispose env_u
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return env_u;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user