Skip to content

Commit c2c659f

Browse files
committed
CI: commit freetds.pc to repo, copy into pkgconfig dir before build
1 parent c102dbc commit c2c659f

2 files changed

Lines changed: 20 additions & 24 deletions

File tree

.github/workflows/swift.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
build:
1111
name: Build & Test
12-
runs-on: macos-14 # Apple Silicon runner, Xcode 15+
12+
runs-on: macos-14
1313

1414
steps:
1515
- name: Checkout
@@ -21,30 +21,13 @@ jobs:
2121
- name: Install FreeTDS
2222
run: brew install freetds
2323

24-
- name: Create freetds.pc for pkg-config
25-
# Homebrew's freetds does not ship a .pc file on macOS.
26-
# We generate one from the known brew prefix so that SPM's
27-
# systemLibrary target can resolve it via pkg-config.
24+
- name: Register freetds.pc with pkg-config
25+
# Homebrew's freetds doesn't ship a .pc file on macOS.
26+
# We ship one in the repo and symlink it into the pkgconfig directory.
2827
run: |
29-
PREFIX=$(brew --prefix freetds)
30-
PC_DIR=/opt/homebrew/lib/pkgconfig
31-
mkdir -p "$PC_DIR"
32-
cat > "$PC_DIR/freetds.pc" << PCEOF
33-
prefix=$PREFIX
34-
exec_prefix=\${prefix}
35-
libdir=\${exec_prefix}/lib
36-
includedir=\${prefix}/include
37-
38-
Name: FreeTDS
39-
Description: FreeTDS library
40-
Version: 1.0
41-
Libs: -L\${libdir} -lsybdb -liconv
42-
Cflags: -I\${includedir}
43-
PCEOF
44-
echo "=== freetds.pc written ==="
45-
cat "$PC_DIR/freetds.pc"
46-
echo "=== pkg-config verify ==="
47-
PKG_CONFIG_PATH="$PC_DIR" pkg-config --cflags --libs freetds
28+
mkdir -p /opt/homebrew/lib/pkgconfig
29+
cp ci/freetds.pc /opt/homebrew/lib/pkgconfig/freetds.pc
30+
pkg-config --cflags --libs freetds
4831
4932
- name: Build
5033
run: swift build -v

ci/freetds.pc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# FreeTDS pkg-config file for macOS (Apple Silicon)
2+
# Committed to repo because Homebrew's freetds does not ship a .pc file on macOS.
3+
# Linux users: this file is ignored; FreeTDS is found via system pkg-config.
4+
prefix=/opt/homebrew/opt/freetds
5+
exec_prefix=${prefix}
6+
libdir=${exec_prefix}/lib
7+
includedir=${prefix}/include
8+
9+
Name: FreeTDS
10+
Description: FreeTDS library
11+
Version: 1.0
12+
Libs: -L${libdir} -lsybdb -liconv
13+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)