Skip to content

Commit ca653cf

Browse files
committed
feat: enhance build scripts to support custom HAMLIB_PREFIX for library paths
1 parent a108979 commit ca653cf

File tree

5 files changed

+465
-8
lines changed

5 files changed

+465
-8
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ jobs:
2121
target: linux-x64
2222
hamlib_install: |
2323
sudo apt-get update
24-
sudo apt-get install -y libhamlib-dev libhamlib-utils patchelf
24+
# Install build tools for compiling Hamlib from source
25+
sudo apt-get install -y autoconf automake libtool pkg-config patchelf
2526
# Install runtime dependencies for bundling
2627
sudo apt-get install -y libusb-1.0-0 libindi1 || true
2728
- os: ubuntu-24.04-arm
2829
arch: arm64
2930
target: linux-arm64
3031
hamlib_install: |
3132
sudo apt-get update
32-
sudo apt-get install -y libhamlib-dev libhamlib-utils patchelf
33+
# Install build tools for compiling Hamlib from source
34+
sudo apt-get install -y autoconf automake libtool pkg-config patchelf
3335
# Install runtime dependencies for bundling
3436
sudo apt-get install -y libusb-1.0-0 libindi1 || true
3537
- os: windows-latest
@@ -69,7 +71,8 @@ jobs:
6971
arch: arm64
7072
target: darwin-arm64
7173
hamlib_install: |
72-
brew install hamlib dylibbundler
74+
# Install build tools for compiling Hamlib from source
75+
brew install autoconf automake libtool dylibbundler
7376
pip3 install setuptools --break-system-packages || true
7477
7578
runs-on: ${{ matrix.os }}
@@ -111,6 +114,25 @@ jobs:
111114
- name: Install Node.js dependencies (skip scripts)
112115
run: npm ci --ignore-scripts
113116

117+
- name: Build Hamlib from source (Linux/macOS)
118+
if: matrix.os != 'windows-latest'
119+
shell: bash
120+
run: |
121+
# Build Hamlib from source to local directory
122+
node scripts/build-hamlib.js --prefix=$PWD/hamlib-build --minimal
123+
124+
# Set environment variables for subsequent steps
125+
echo "HAMLIB_PREFIX=$PWD/hamlib-build" >> $GITHUB_ENV
126+
127+
# Set library path for runtime (needed for bundle scripts)
128+
if [ "${{ runner.os }}" = "Linux" ]; then
129+
echo "LD_LIBRARY_PATH=$PWD/hamlib-build/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
130+
elif [ "${{ runner.os }}" = "macOS" ]; then
131+
echo "DYLD_LIBRARY_PATH=$PWD/hamlib-build/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
132+
fi
133+
134+
echo "PKG_CONFIG_PATH=$PWD/hamlib-build/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
135+
114136
- name: Setup Developer Command Prompt (Windows)
115137
if: matrix.os == 'windows-latest'
116138
uses: ilammy/msvc-dev-cmd@v1

binding.gyp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
# Linux configuration
2424
["OS==\"linux\"", {
2525
"include_dirs": [
26+
"<!@(node -e \"if(process.env.HAMLIB_PREFIX) console.log(process.env.HAMLIB_PREFIX + '/include')\")",
2627
"/usr/include",
2728
"/usr/local/include"
2829
],
2930
"libraries": [
31+
"<!@(node -e \"if(process.env.HAMLIB_PREFIX) console.log('-L' + process.env.HAMLIB_PREFIX + '/lib')\")",
3032
"-L/usr/lib",
3133
"-L/usr/local/lib",
3234
"-lhamlib"
@@ -38,10 +40,12 @@
3840
# macOS configuration
3941
["OS==\"mac\"", {
4042
"include_dirs": [
43+
"<!@(node -e \"if(process.env.HAMLIB_PREFIX) console.log(process.env.HAMLIB_PREFIX + '/include')\")",
4144
"/usr/local/include",
4245
"/opt/homebrew/include"
4346
],
4447
"libraries": [
48+
"<!@(node -e \"if(process.env.HAMLIB_PREFIX) console.log('-L' + process.env.HAMLIB_PREFIX + '/lib')\")",
4549
"-L/usr/local/lib",
4650
"-L/opt/homebrew/lib",
4751
"-lhamlib"

0 commit comments

Comments
 (0)