Skip to content

Commit

Permalink
Fix install on OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Oct 24, 2024
1 parent f7020f7 commit 2ae7cb0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/openbsd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ jobs:
R.version[["platform"]]
.libPaths()
.Library
Sys.getenv("R_LIBS_SITE")
Sys.getenv("R_LIBS_USER")
find.package("pak")
Sys.getenv()
shell: Rscript {0}

- uses: r-hub/actions/debug-shell@main

- name: Install system packages
run: |
pkg_add -I libbind
cd /usr/local/lib && ln -s libbind/libbind.so* .
shell: openbsd {0}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
pak-version: none
Expand Down
16 changes: 12 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ unset FREEBSD
if [ "$UNAME" = "FreeBSD" ]; then FREEBSD=true; POSIX=true; fi

unset OPENBSD
## if [ "$UNAME" = "OpenBSD" ]; then OPENBSD=true; POSIX=true; fi
if [ "$UNAME" = "OpenBSD" ]; then OPENBSD=true; POSIX=true; fi

unset NETBSD
## if [ "$UNAME" = "NetBSD" ]; then NETBSD=true; POSIX=true; fi
Expand All @@ -61,12 +61,19 @@ unset AIX
# Set source files, macros, libs, compile flags
# ------------------------------------------------------------------------

CPPFLAGS=

if [ -n "$WINDOWS" ]; then
LIBRARIES=

elif [ -n "$FREEBSD" ]; then
LIBRARIES=

elif [ -n "$OPENBSD" ]; then
LIBRARIES=bind
LIBDIRS=-L/usr/local/lib/libbind
CPPFLAGS=-I/usr/local/include/bind

else
LIBRARIES=resolv
fi
Expand All @@ -79,10 +86,11 @@ fi
# LIBRARIES -> PKG_LIBS

LIBS=`for l in $LIBRARIES; do echo "-l${l}"; done | tr "\n", " "`
LIBS="${LIBS} $FRAMEWORKS"
LIBS="$LIBDIRS ${LIBS} $FRAMEWORKS"

cat src/Makevars.in | \
sed "s|@OBJECTS@|${OBJECTS}|" | \
sed "s/@LIBS@/${LIBS}/" | \
sed "s/@TARGETS@/${TARGETS}/" | \
sed "s|@LIBS@|${LIBS}|" | \
sed "s|@TARGETS@|${TARGETS}|" | \
sed "s|@CPPFLAGS@|${CPPFLAGS}|" | \
sed "s|@EXTRA@|${EXTRA}|" > src/Makevars
1 change: 1 addition & 0 deletions src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PKG_LIBS = @LIBS@
PKG_CPPFLAGS = @CPPFLAGS@
4 changes: 4 additions & 0 deletions src/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#ifdef _WIN32
#include <Winsock2.h>
#include <ws2tcpip.h>
#else
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#endif

#undef ERROR
Expand Down

0 comments on commit 2ae7cb0

Please sign in to comment.