Fixed Mac Shipping

This commit is contained in:
Kylart 2020-01-30 19:02:41 +01:00
parent d64aa5a69b
commit 4e31838f0f
7 changed files with 28 additions and 74 deletions

View File

@ -1,10 +1,3 @@
/* global __static */
// import bindings from './build/Release/kawabinds.node'
import { join } from 'path'
const bindings = process.env.NODE_ENV === 'development'
? './build/Release/kawabinds.node'
: join(__static, 'kawabinds', 'kawabinds.node')
import bindings from './build/Release/kawabinds.node'
export default bindings

View File

@ -10,47 +10,30 @@ copy_deps() {
[[ -e $dir/$depname ]] || install -m755 $dep $dir
otool -L $dep | awk '/\/usr\/local.*\.dylib /{print $1}' | while read lib; do
otool -L $dep | awk '/@rpath\/.*\.dylib /{print $1}' | while read lib; do
local libname=$(basename $lib)
[[ $depname = $libname ]] && continue
echo $libname
install_name_tool -change $lib @loader_path/$libname $dir/$depname
[[ -e $dir/$libname ]] && continue
install -m755 $lib $dir
install -m755 /usr/local/lib/$libname $dir
copy_deps $lib $dir
done
}
set +x
copy_deps /usr/local/lib/libmpv.1.dylib public/mpv
copy_deps bindings/build/Release/libtorrent-rasterbar.dylib public/kawabinds
copy_deps bindings/build/Release/libtorrent-rasterbar.10.dylib public/kawabinds
copy_deps bindings/build/Release/libtorrent-rasterbar.1.2.3.dylib public/kawabinds
if [[ $OSTYPE =~ darwin ]]
then
echo "[KawAnime] Collecting dylibs"
copy_deps bindings/build/Release/kawabinds.node public/kawabinds
set -x
set +x
copy_deps /usr/local/lib/libmpv.1.dylib public/mpv
copy_deps bindings/build/Release/libtorrent-rasterbar.10.dylib public
set -x
# See <https://github.com/Kagami/boram/issues/11>.
install_name_tool -change /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/Versions/A/CoreImage public/mpv/libavfilter.7.dylib
install_name_tool -change /usr/local/opt/mpv/lib/libmpv.1.dylib '@loader_path/libmpv.1.dylib' ./public/mpv/mpvjs.node
# See <https://github.com/Kagami/boram/issues/11>.
install_name_tool -change /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage /System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/Versions/A/CoreImage public/mpv/libavfilter.7.dylib
install_name_tool -change /usr/local/opt/mpv/lib/libmpv.1.dylib '@loader_path/libmpv.1.dylib' ./public/mpv/mpvjs.node
# libtorrent-rasterbar.dylib
install_name_tool -change @rpath/libtorrent-rasterbar.10.dylib '@loader_path/libtorrent-rasterbar.10.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
install_name_tool -change /usr/local/opt/boost/lib/libboost_system.dylib '@loader_path/libboost_system.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
install_name_tool -change /usr/local/opt/gcc/lib/gcc/9/libstdc++.6.dylib '@loader_path/libstdc++.6.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
# libtorrent-rasterbar.10.dylib
install_name_tool -change @rpath/libtorrent-rasterbar.10.dylib '@loader_path/libtorrent-rasterbar.10.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
install_name_tool -change /usr/local/opt/boost/lib/libboost_system.dylib '@loader_path/libboost_system.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
install_name_tool -change /usr/local/opt/gcc/lib/gcc/9/libstdc++.6.dylib '@loader_path/libstdc++.6.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
# libtorrent-rasterbar.1.2.3.dylib
install_name_tool -change @rpath/libtorrent-rasterbar.10.dylib '@loader_path/libtorrent-rasterbar.10.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
install_name_tool -change /usr/local/opt/boost/lib/libboost_system.dylib '@loader_path/libboost_system.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
install_name_tool -change /usr/local/opt/gcc/lib/gcc/9/libstdc++.6.dylib '@loader_path/libstdc++.6.dylib' ./public/kawabinds/libtorrent-rasterbar.dylib
# kawabinds.node
install_name_tool -change @rpath/kawabinds.node '@loader_path/kawabinds.node' ./public/kawabinds/kawabinds.node
install_name_tool -change @rpath/libtorrent-rasterbar.10.dylib '@loader_path/libtorrent-rasterbar.10.dylib' ./public/kawabinds/kawabinds.node
install_name_tool -change /usr/local/opt/boost/lib/libboost_system.dylib '@loader_path/libstdc++.6.dylib' ./public/kawabinds/kawabinds.node
install_name_tool -change /usr/local/opt/gcc/lib/gcc/9/libstdc++.6.dylib '@loader_path/libboost_system.dylib' ./public/kawabinds/kawabinds.node
install_name_tool -change "@rpath/libtorrent-rasterbar.10.dylib" "@loader_path/libtorrent-rasterbar.10.dylib" bindings/build/Release/kawabinds.node
install_name_tool -change "@rpath/libboost_system.dylib" "@loader_path/libboost_system.dylib" bindings/build/Release/kawabinds.node
fi

View File

@ -14,13 +14,13 @@
"start": "cross-env NODE_ENV=production npm run build:after && electron dist/bundled/background.js",
"build": "vue-cli-service electron:build",
"build:after": "node scripts/afterBuild.js",
"build:bindings": "cmake-js build -d bindings -O bindings/build && cp -r bindings/build/Release/ public/kawabinds/",
"build:bindings": "cmake-js build -d bindings -O bindings/build && ./collect-dylib-deps.sh",
"pack": "npm run build -- --dir",
"dist": "npm run dist:mac && npm run dist:win && npm run dist:linux",
"dist:mac": "npm run build -- --mac",
"dist:win": "npm run build -- --win --x64 --ia32",
"dist:portable": "npm run build -- --win portable",
"dist:linux": "npm run build -- --linux deb AppImage",
"dist:mac": "cross-env NODE_ENV=production npm run build -- --mac",
"dist:win": "cross-env NODE_ENV=production npm run build -- --win --x64 --ia32",
"dist:portable": "cross-env NODE_ENV=production npm run build -- --win portable",
"dist:linux": "cross-env NODE_ENV=production npm run build -- --linux deb AppImage",
"publish:mac": "npm run build -- --mac -p always",
"publish:linux": "npm run build -- --linux deb AppImage -p always",
"publish:win": "npm run build -- --win --x64 --ia32 -p always",

BIN
public/libboost_system.dylib Executable file

Binary file not shown.

Binary file not shown.

View File

@ -19,7 +19,6 @@ const getAllFiles = (dir) =>
const VERSION = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'))).version
const VENDOR_PATH = path.join(__dirname, 'src', 'vendor')
const BIDNINGS_PATH = path.join(__dirname, 'bindings')
const PUBLIC_PATH = path.join(__dirname, 'public')
process.env.VUE_APP_KAWANIME_VERSION = VERSION
@ -42,6 +41,11 @@ module.exports = {
builderOptions: {
appId: 'KawAnime',
productName: 'KawAnime',
// See https://github.com/electron-userland/electron-builder/issues/2738#issuecomment-378837434
// Not needed anyway
asar: false,
dmg: {
contents: [
{
@ -73,33 +77,7 @@ module.exports = {
]
}],
linux: {
category: 'Network',
extraResources: [
{
from: './bindings/build/Release',
to: '.',
filter: ['*.so']
},
{
from: './public/mpv',
to: 'mpv',
filter: ['*.so', '*.node']
}
]
},
win: {
extraResources: [
{
from: '.\\bindings\\build\\Release',
to: '.',
filter: ['*.dll']
},
{
from: '.\\public\\mpv',
to: 'mpv',
filter: ['*.dll', '*.node']
}
]
category: 'Network'
}
},
chainWebpackMainProcess: (config) => {
@ -117,7 +95,7 @@ module.exports = {
.alias
.set('vendor', VENDOR_PATH)
.set('kawabinds', BIDNINGS_PATH)
.set('public', PUBLIC_PATH)
.set('plugin', process.env.NODE_ENV === 'development' ? path.join(__dirname, 'public') : __dirname)
},
chainWebpackRendererProcess: (config) => {
// Chain webpack config for electron renderer process only