Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
temp/
/gen/
/.openbsd-check/
output_Win32_*/
output_x64_*/
examples/prebuilt/
Expand Down
16 changes: 16 additions & 0 deletions builds/install/arch-specific/openbsd/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ROOT=$(shell cd ..; pwd)
TARGET ?= Release

include $(ROOT)/gen/make.defaults
include $(ROOT)/gen/make.platform

.PHONY: install

# Stage files only. Account creation and service activation belong to packaging.
install:
@test -n "$(DESTDIR)" || { echo 'Specify DESTDIR for a staging installation.'; exit 1; }
@case "$(DESTDIR)" in /*) ;; *) echo 'DESTDIR must be an absolute path.'; exit 1;; esac
@test "$(DESTDIR)" != / || { echo 'DESTDIR must not be the filesystem root.'; exit 1; }
@test ! -e "$(DESTDIR)@prefix@" || { echo 'The staging prefix already exists.'; exit 1; }
mkdir -p "$(DESTDIR)@prefix@"
cp -RLp "$(FB_BUILD)/." "$(DESTDIR)@prefix@/"
26 changes: 16 additions & 10 deletions builds/posix/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ ifeq ($(TOMMATH_BUILD_FLG),Y)
ifeq ($(PLATFORM),DARWIN)
install_name_tool -id "@rpath/lib/libtommath.dylib" $(TOMMATH)/.libs/libtommath.0.dylib
cp $(TOMMATH)/.libs/libtommath.0.dylib $(LIB)/libtommath.dylib
else ifeq ($(PLATFORM),OPENBSD)
name=`sed -n "s/^dlname='\(.*\)'/\1/p" $(TOMMATH)/libtommath.la`; \
test -n "$$name" && test -f "$(TOMMATH)/.libs/$$name" && \
ln -sf "$(TOMMATH)/.libs/$$name" "$(LIB)/$$name" && \
ln -sf "$$name" "$(LIB)/libtommath.so"
else
ln -sf $(TOMMATH_SO).$(TOMMATH_VER) $(LIB)
ln -sf $(TOMMATH_SO) $(LIB)
Expand All @@ -234,6 +239,11 @@ ifeq ($(TOMCRYPT_BUILD_FLG),Y)
ifeq ($(PLATFORM),DARWIN)
install_name_tool -id "@rpath/lib/libtomcrypt.dylib" $(TOMCRYPT)/.libs/libtomcrypt.1.dylib
cp $(TOMCRYPT)/.libs/libtomcrypt.1.dylib $(LIB)/libtomcrypt.dylib
else ifeq ($(PLATFORM),OPENBSD)
name=`sed -n "s/^dlname='\(.*\)'/\1/p" $(TOMCRYPT)/libtomcrypt.la`; \
test -n "$$name" && test -f "$(TOMCRYPT)/.libs/$$name" && \
ln -sf "$(TOMCRYPT)/.libs/$$name" "$(LIB)/$$name" && \
ln -sf "$$name" "$(LIB)/libtomcrypt.so"
else
ln -sf $(TOMCRYPT_SO).$(TOMCRYPT_VER) $(LIB)
ln -sf $(TOMCRYPT_SO) $(LIB)
Expand Down Expand Up @@ -337,12 +347,12 @@ master_process:
$(MAKE) external
$(MAKE) updateCloopInterfaces
$(MAKE) rest
$(MAKE) include_generic
$(MAKE) yvalve
ifeq ($(CLIENT_ONLY_FLG),Y)
ifeq ($(WITH_TOMCRYPT),Y)
$(MAKE) chacha
endif
$(MAKE) include_generic
endif
ifeq ($(CLIENT_ONLY_FLG),N)
$(MAKE) boot
Expand Down Expand Up @@ -740,25 +750,21 @@ gbak_files: $(GBAK_FILES)

INCLUDE_DEST= $(FB_BUILD)/include

# ib_util.h actually is a marker for a number of headers

# Copy all the other headers to the distribution directory. We use
# ib_util.h as the marker for all the files.

OtherDistribHeaders = include/ib_util.h \
include/iberror.h \
include/ibase.h

SRC_OtherDistribHeaders = $(addprefix $(SRC_ROOT)/, $(OtherDistribHeaders))
DEST_OtherDistribHeaders = $(addprefix $(FB_BUILD)/, $(OtherDistribHeaders))

$(INCLUDE_DEST)/ib_util.h : $(SRC_OtherDistribHeaders)
$(DEST_OtherDistribHeaders): $(INCLUDE_DEST)/%: $(SRC_ROOT)/include/%
mkdir -p $(INCLUDE_DEST)
$(CP) $^ $(INCLUDE_DEST)/
$(CP) $< $@

NEW_INCLUDES_SRC = $(shell find $(SRC_ROOT)/include/firebird -type f)
NEW_INCLUDES_DEST = $(patsubst $(SRC_ROOT)/include/firebird/%, $(INCLUDE_DEST)/firebird/%, $(NEW_INCLUDES_SRC))

include_generic: $(NEW_INCLUDES_DEST) $(INCLUDE_DEST)/ib_util.h
.PHONY: include_generic
include_generic: $(NEW_INCLUDES_DEST) $(DEST_OtherDistribHeaders)

ifeq ($(SYSTEM_BOOST_FLG),Y)
$(INCLUDE_DEST)/firebird/Message.h : $(SRC_ROOT)/include/firebird/Message.h
Expand Down
118 changes: 118 additions & 0 deletions builds/posix/check-openbsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/bin/sh
# Build and test a disposable checkout. Do not run this as root.
set -eu
umask 022

fail()
{
printf '%s\n' "$*" >&2
exit 1
}

[ "$(uname -s)" = OpenBSD ] || fail 'This check requires OpenBSD.'
case "$(uname -m)" in
amd64|i386) ;;
*) fail 'Only amd64 and i386 are covered by this port.' ;;
esac
[ "$(id -u)" != 0 ] || fail 'Use an unprivileged account.'

fb_source=$(CDPATH= cd "$(dirname "$0")/../.." && pwd -P)
cd "$fb_source"
case "$fb_source" in
*[!a-zA-Z0-9_./-]*) fail 'Use a source path containing only letters, digits, _, ., / and -.' ;;
esac
[ -f configure.ac ] && [ -d src/common ] || fail 'Firebird source tree not found.'
[ ! -e config.status ] && [ ! -e Makefile ] && [ ! -e gen/Release ] ||
fail 'Use a fresh, unconfigured checkout; existing build files are left untouched.'
fb_check="$fb_source/.openbsd-check"
[ ! -e "$fb_check" ] || fail 'The .openbsd-check directory already exists; keep its logs for review.'

: "${AUTOCONF_VERSION:=2.72}"
: "${AUTOMAKE_VERSION:=1.18}"
: "${JOBS:=1}"
case "$JOBS" in ''|*[!0-9]*|0*) fail 'JOBS must be a positive integer without leading zeroes.' ;; esac
export AUTOCONF_VERSION AUTOMAKE_VERSION

unset LIBS LD_LIBRARY_PATH FIREBIRD FIREBIRD_LOCK FIREBIRD_MSG FIREBIRD_TMP
unset FIREBIRD_BOOT_BUILD ISC_USER ISC_PASSWORD MAKEFLAGS MFLAGS NOCONFIGURE
unset AUTORECONF ACLOCAL LIBTOOL LIBTOOLIZE
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export CC=cc CXX=c++ CFLAGS= CXXFLAGS=
export CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib

for tool in cc c++ gmake cmake unzip autoreconf aclocal libtoolize
do
command -v "$tool" >/dev/null 2>&1 || fail "Required tool not found: $tool"
done

mkdir "$fb_check"
mkdir "$fb_check/locks" "$fb_check/tmp"
{
uname -a
cc --version
c++ --version
gmake --version
cmake --version
autoreconf --version
aclocal --version
pkg_info
df -h .
swapctl -sk
ulimit -a
if [ -f OPENBSD-SNAPSHOT.txt ]; then
cat OPENBSD-SNAPSHOT.txt
fi
if command -v git >/dev/null 2>&1 && [ -d .git ]; then
git rev-parse HEAD
git status --short
git diff --stat
fi
} >"$fb_check/environment.log" 2>&1

run()
{
fb_step=$1
shift
printf '%s: %s\n' "$fb_step" "$*"
if "$@" >"$fb_check/$fb_step.log" 2>&1; then
printf '%s: OK\n' "$fb_step"
else
fb_rc=$?
tail -n 60 "$fb_check/$fb_step.log"
fail "$fb_step failed (status $fb_rc). Logs: $fb_check"
fi
}

run configure sh ./autogen.sh --prefix=/opt/firebird-openbsd-test --disable-binreloc --disable-raw-devices --with-builtin-tommath --with-builtin-tomcrypt
export ISC_USER=SYSDBA
run build gmake -j"$JOBS" TARGET=Release
run test-build gmake -C gen TARGET=Release tests

export FIREBIRD="$fb_source/gen/Release/firebird"
export FIREBIRD_LOCK="$fb_check/locks" FIREBIRD_TMP="$fb_check/tmp"
export LD_LIBRARY_PATH="$FIREBIRD/lib:/usr/local/lib"
run common-tests "$FIREBIRD/tests/common_test" --log_level=all
run engine-tests "$FIREBIRD/tests/engine_test" --log_level=all
run stage gmake -C gen -f Makefile.install TARGET=Release DESTDIR="$fb_check/stage" install

export FIREBIRD="$fb_check/stage/opt/firebird-openbsd-test"
export LD_LIBRARY_PATH="$FIREBIRD/lib:/usr/local/lib"
for header in ibase.h ib_util.h iberror.h firebird/Interface.h firebird/fb_c_api.h firebird/impl/iberror_c.h
do
[ -f "$FIREBIRD/include/$header" ] || fail "Missing staged SDK header: $header"
done

run sdk-build cc -I"$FIREBIRD/include" -L"$FIREBIRD/lib" -Wl,-rpath,"$FIREBIRD/lib" -x c - -lfbclient -o "$fb_check/sdk-test" <<'EOF'
#include <ibase.h>
#include <stdio.h>
int main(void)
{
ISC_SCHAR version[256] = {0};
isc_get_client_version(version);
puts((const char*) version);
return 0;
}
EOF
run sdk-run "$fb_check/sdk-test"
run sdk-libraries ldd "$fb_check/sdk-test"
printf 'Checks completed. Review the logs in %s. No service was started or installed.\n' "$fb_check"
2 changes: 1 addition & 1 deletion builds/posix/make.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ AC_LDFLAGS = @LDFLAGS@

# LINKER COMMANDS

ifeq ($(PLATFORM),DARWIN)
ifneq ($(filter DARWIN OPENBSD,$(PLATFORM)),)
LIB_LINK = $(CXX) $(GLOB_OPTIONS) $(CXXFLAGS) $(WLDFLAGS)
EXE_LINK = $(CXX) $(GLOB_OPTIONS) $(CXXFLAGS) $(WLDFLAGS)
else
Expand Down
16 changes: 16 additions & 0 deletions builds/posix/prefix.openbsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# OpenBSD amd64/i386, using the base-system C/C++ compiler.

PROD_FLAGS=-O2 -pipe -MMD -fPIC
DEV_FLAGS=-g -DDEBUG_GDS_ALLOC -pipe -MMD -fPIC -Wall -Werror=delete-incomplete

ifeq ($(CpuType),x86_64)
PROD_FLAGS += -mcx16
DEV_FLAGS += -mcx16
endif

%/CRC32C.o: CXXFLAGS += -msse4.2

# Use the configured GNU libtool, not OpenBSD's unrelated /usr/bin/libtool.
export LIBTOOL=$(ROOT)/libtool

export LD_LIBRARY_PATH:=$(LIB):/usr/local/lib$(if $(LD_LIBRARY_PATH),:$(LD_LIBRARY_PATH))
3 changes: 2 additions & 1 deletion builds/win32/msvc15/common_test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\common\tests\CommonTest.cpp" />
<ClCompile Include="..\..\..\src\common\tests\SockAddrTest.cpp" />
<ClCompile Include="..\..\..\src\common\classes\tests\AlignerTest.cpp" />
<ClCompile Include="..\..\..\src\common\classes\tests\ArrayTest.cpp" />
<ClCompile Include="..\..\..\src\common\classes\tests\DoublyLinkedListTest.cpp" />
Expand All @@ -200,4 +201,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
5 changes: 4 additions & 1 deletion builds/win32/msvc15/common_test.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<ClCompile Include="..\..\..\src\common\tests\CommonTest.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\tests\SockAddrTest.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\common\classes\tests\AlignerTest.cpp">
<Filter>source</Filter>
</ClCompile>
Expand All @@ -31,4 +34,4 @@
<Filter>source</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>
15 changes: 15 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,15 @@ dnl CPU_TYPE=ppc64
SHRLIB_EXT=so
;;

x86_64-*-openbsd* | i?86-*-openbsd*)
MAKEFILE_PREFIX=openbsd
PLATFORM=OPENBSD
AC_DEFINE(OPENBSD, 1, [Define this if OS is OpenBSD])
EDITLINE_FLG=Y
RAW_DEVICES_FLG=N
SHRLIB_EXT=so
;;

*-*-netbsd*)
MAKEFILE_PREFIX=netbsd
PLATFORM=NETBSD
Expand Down Expand Up @@ -898,6 +907,12 @@ AC_CHECK_TOOL([RANLIB], [ranlib])
AC_CHECK_TOOL([READELF], [readelf])
LT_INIT([dlopen win32-dll])

if test "$PLATFORM" = "OPENBSD"; then
AC_CHECK_HEADERS([sys/futex.h], [], [AC_MSG_ERROR([OpenBSD futex support is required])],
[[#include <sys/time.h>]])
AC_CHECK_FUNCS([futex], [], [AC_MSG_ERROR([OpenBSD futex support is required])])
fi

dnl Check for system header files
AC_HEADER_DIRENT
AC_HEADER_STDC
Expand Down
Loading