Skip to content

Commit dc9336d

Browse files
committed
Use dylibbundler instead of hacked bundler
1 parent d7b2328 commit dc9336d

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ all: frontend pob
1212
cp ${DIR}/Info.plist.sh ${DIR}/PathOfBuilding.app/Contents/Info.plist; \
1313
echo 'Finished'
1414

15+
# Sign with the first available identity
16+
sign:
17+
echo 'Signing with the first available identity'; \
18+
rm -rf PathOfBuilding.app/Contents/MacOS/spec/TestBuilds/3.13; \
19+
codesign --force --deep --sign $$(security find-identity -v -p codesigning | awk 'FNR == 1 {print $$2}') PathOfBuilding.app; \
20+
codesign -d -v PathOfBuilding.app
21+
1522
pob: load_pob luacurl frontend
1623
rm -rf PathOfBuildingBuild; \
1724
cp -rf PathOfBuilding PathOfBuildingBuild; \
@@ -44,8 +51,9 @@ luacurl:
4451
popd
4552

4653
# curl is used since mesonInstaller.sh copies over the shared library dylib
54+
# dylibbundler is used to copy over dylibs that lcurl.so uses
4755
tools:
48-
brew install qt@5 luajit zlib meson curl
56+
brew install qt@5 luajit zlib meson curl dylibbundler
4957

5058
# We don't usually modify the PathOfBuilding directory, so there's rarely a
5159
# need to delete it. We separate it out to a separate task.

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ Error loading main script: error loading module 'lcurl.safe' from file './lcurl.
4343
Expected in: /usr/lib/libcurl.4.dylib
4444
```
4545

46-
To try to fix this issue, we include the libcurl.4.dylib in our app.
46+
To try to fix this issue, we include the libcurl.4.dylib in our app
47+
using dylibbundler.
4748

4849
We change it in mesonInstaller.sh based on https://stackoverflow.com/a/38709580/319066
4950

50-
- `otool -L lcurl.so` can be used to debug the paths
51-
- `install_name_tool ...` is used to change the paths
51+
- `otool -L lcurl.so` can be used to debug the paths.
52+
- `install_name_tool ...` is used to change the paths behind the scenes, but
53+
dylibbundler does all the work for us.
5254

5355
## Old manual steps to build:
5456

meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ else
1010
gl_dep = dependency('gl')
1111
endif
1212
zlib_dep = dependency('zlib')
13+
curl_dep = dependency('libcurl')
1314

1415
# Import the extension module that knows how
1516
# to invoke Qt tools.
@@ -18,7 +19,7 @@ prep = qt5.preprocess(moc_headers : ['subscript.hpp', 'pobwindow.hpp'])
1819

1920
executable('PathOfBuilding',
2021
sources : ['main.cpp', prep],
21-
dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep],
22+
dependencies : [qt5_dep, gl_dep, zlib_dep, lua_dep, curl_dep],
2223
install : true)
2324

2425

mesonInstaller.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/bash
22

3-
cp -rf ${MESON_SOURCE_ROOT}/PathOfBuildingBuild/* ${MESON_INSTALL_PREFIX}/Contents/MacOS/
4-
cp -f ${MESON_SOURCE_ROOT}/fonts/*.ttf ${MESON_INSTALL_PREFIX}/Contents/MacOS/
3+
cp -rf "${MESON_SOURCE_ROOT}"/PathOfBuildingBuild/* "${MESON_INSTALL_PREFIX}"/Contents/MacOS/
4+
cp -f "${MESON_SOURCE_ROOT}"/fonts/*.ttf "${MESON_INSTALL_PREFIX}"/Contents/MacOS/
55

6-
mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks
6+
mkdir -p "${MESON_INSTALL_PREFIX}/Contents/Frameworks"
77

8-
# This is an attempted fix to the error on old Mac versions:
8+
# Meson doesn't bundle dependencies of our shared library by default, so we have
9+
# to do it on our own.
10+
#
11+
# This fixes the error:
912
# "Symbol not found: _curl_easy_option_by_id" since that didn't exist in older
1013
# cURL libraries.
11-
#
12-
# Copy over the library
13-
cp -f "$(brew --prefix --installed curl)/lib/libcurl.4.dylib" ${MESON_INSTALL_PREFIX}/Contents/Frameworks
14-
# Change the reference to refer to the new library path
15-
install_name_tool -change "$(brew --prefix --installed curl)/lib/libcurl.4.dylib" @executable_path/../Frameworks/libcurl.4.dylib ${MESON_INSTALL_PREFIX}/Contents/MacOS/lcurl.so
14+
echo 'Bundling dylibs for lcurl.so'
15+
cd "${MESON_INSTALL_PREFIX}/Contents"
16+
dylibbundler --overwrite-dir --create-dir --bundle-deps --fix-file MacOS/lcurl.so

0 commit comments

Comments
 (0)