Skip to content

Commit 4b71f07

Browse files
tfcollinspcercuei
authored andcommitted
Add rpathing and libusb updates for macOS CI
Signed-off-by: Travis F. Collins <[email protected]>
1 parent 9cc2e10 commit 4b71f07

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

CI/azure/macos_tar_fixup.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash -xe
2+
3+
# Extract tar.gz to temp folder
4+
tarname=$(find . -maxdepth 1 -name '*.tar.gz')
5+
if [ -z "${tarname}" ]; then
6+
echo "tar.gz not found"
7+
exit 1
8+
fi
9+
# Remove .tar.gz from filename
10+
subfoldername=$(echo "${tarname}" | rev | cut -b 8- | rev)
11+
12+
mkdir -p temp_tar
13+
tar -xzf "${tarname}" -C temp_tar
14+
mv "temp_tar/${subfoldername}" temp
15+
cd temp
16+
17+
# Update rpath of library and tools
18+
libusb_loc=$(find $(brew --cellar) -name libusb-1.0.dylib)
19+
libxml_loc=$(find $(brew --cellar) -name libxml2.dylib)
20+
libserialport_loc=$(find $(brew --cellar) -name libserialport.dylib)
21+
libiio_loc=$(find . -name iio | grep Versions)
22+
libiioheader_loc=$(find . -name iio.h)
23+
24+
if [ ! -f "${libusb_loc}" ]; then
25+
echo "libusb library not found"
26+
exit 1
27+
fi
28+
if [ ! -f "${libxml_loc}" ]; then
29+
echo "libxml library not found"
30+
exit 1
31+
fi
32+
if [ ! -f "${libserialport_loc}" ]; then
33+
echo "libserialport library not found"
34+
exit 1
35+
fi
36+
37+
# Create links to framework files
38+
mkdir -p usr/local/{lib,include}
39+
ln -fs "${libiio_loc}" usr/local/lib/libiio.dylib
40+
ln -fs "${libiioheader_loc}" usr/local/include/iio.h
41+
42+
# Copy dependent libs to local libs
43+
cp "${libusb_loc}" usr/local/lib/
44+
cp "${libxml_loc}" usr/local/lib/
45+
cp "${libserialport_loc}" usr/local/lib/
46+
chmod +w usr/local/lib/libusb-1.0.dylib
47+
chmod +w usr/local/lib/libxml2.dylib
48+
chmod +w usr/local/lib/libserialport.dylib
49+
install_name_tool -id @rpath/libusb-1.0.dylib usr/local/lib/libusb-1.0.dylib
50+
install_name_tool -id @rpath/libxml2.dylib usr/local/lib/libxml2.dylib
51+
install_name_tool -id @rpath/libserialport.dylib usr/local/lib/libserialport.dylib
52+
53+
# Update rpath of library
54+
install_name_tool -change "${libusb_loc}" "@rpath/libusb-1.0.dylib" "${libiio_loc}"
55+
install_name_tool -change "${libxml_loc}" "@rpath/libxml2.dylib" "${libiio_loc}"
56+
install_name_tool -change "${libserialport_loc}" "@rpath/libserialport.dylib" "${libiio_loc}"
57+
install_name_tool -add_rpath @loader_path/. "${libiio_loc}"
58+
59+
# Update tools
60+
cd Library/Frameworks/iio.framework/Tools
61+
for tool in *;
62+
do
63+
install_name_tool -add_rpath @loader_path/../.. "${tool}"
64+
done
65+
cd ../../../../
66+
67+
# Remove old tar and create new one
68+
rm "../${tarname}"
69+
tar -czf "../${tarname}" .
70+
cd ..
71+
rm -rf temp

CI/azure/prepare_assets.sh

100755100644
File mode changed.

azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ stages:
321321
cmake .. -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DOSX_PACKAGE=OFF -DENABLE_PACKAGING=ON -DCPP_BINDINGS=ON -DPYTHON_BINDINGS=ON -DWITH_SERIAL_BACKEND=OFF -DWITH_ZSTD=OFF -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} -DCMAKE_SYSTEM_NAME="Darwin"
322322
make
323323
make package
324+
mv ../CI/azure/macos_tar_fixup.sh .
325+
chmod +x macos_tar_fixup.sh
326+
./macos_tar_fixup.sh
324327
cd ..
325328
displayName: 'Build tar'
326329
- script: |

0 commit comments

Comments
 (0)