Skip to content
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,31 @@ jobs:
if-no-files-found: 'error'
retention-days: 1
compression-level: 0

freebsd_builds:
runs-on: ubuntu-latest
strategy:
matrix:
freebsd_arch: [aarch64, amd64]
steps:
- uses: actions/checkout@v4

- name: Build freebsd-${{ matrix.freebsd_arch }} Prebuild
uses: vmactions/freebsd-vm@v1
with:
arch: ${{ matrix.freebsd_arch }}
usesh: true
prepare: |
pkg install -y krb5 node npm pkgconf
run: |
node .github/scripts/build.mjs

- id: upload
name: Upload prebuild
uses: actions/upload-artifact@v4
with:
name: build-freebsd-${{ matrix.freebsd_arch }}
path: prebuilds/
if-no-files-found: 'error'
retention-days: 1
compression-level: 0
16 changes: 13 additions & 3 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
]
}
}],
['OS=="mac" or OS=="linux"', {
['OS=="mac" or OS=="linux" or OS=="freebsd"', {
'sources': [
'src/unix/base64.cc',
'src/unix/kerberos_gss.cc',
'src/unix/kerberos_unix.cc'
]
}],
['(OS=="mac") or (OS=="linux" and kerberos_use_rtld!="true")', {
['(OS=="mac") or ((OS=="linux" or OS=="freebsd") and kerberos_use_rtld!="true")', {
'link_settings': {
'libraries': [
'-lkrb5',
Expand All @@ -78,14 +78,24 @@
}]
]
}],
['(OS=="linux") and (kerberos_use_rtld=="true")', {
['(OS=="linux" or OS=="freebsd") and (kerberos_use_rtld=="true")', {
'defines': ['KERBEROS_USE_RTLD=1'],
'link_settings': {
'libraries': [
'-ldl',
]
},
}],
['OS=="freebsd"', {
'include_dirs+': [
'<!(pkg-config krb5 --cflags-only-I | sed -E "s/(-I *|-isystem *)//g")',
],
'link_settings': {
'library_dirs': [
'<!(pkg-config krb5 --libs-only-L | sed -e "s/-L//g")',
]
},
}],
['OS=="win"', {
'sources': [
'src/win32/kerberos_sspi.cc',
Expand Down
2 changes: 1 addition & 1 deletion src/kerberos_common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef KERBEROS_COMMON_H
#define KERBEROS_COMMON_H

#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#include "unix/kerberos_gss.h"

namespace node_kerberos {
Expand Down
7 changes: 7 additions & 0 deletions src/unix/kerberos_gss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,17 @@ struct DLOpenHandle {
DLOpenHandle& operator=(DLOpenHandle&) = delete;
};

#ifndef __FreeBSD__
#define DYLIBS(V) \
V(gssapi, "libgssapi_krb5.so.2") \
V(krb5, "libkrb5.so.3") \
V(comerr, "libcom_err.so.2")
#else
#define DYLIBS(V) \
V(gssapi, "libgssapi_krb5.so.2") \
V(krb5, "libkrb5.so.3") \
V(comerr, "libcom_err.so.3")
#endif

#define LIBRARY_HANDLE_GETTER(name, lib) \
static const DLOpenHandle& name ## _handle() { \
Expand Down