Can now ship windows build with libssl and libcrypto 1.1

This commit is contained in:
Kylart 2020-03-29 18:52:46 +02:00
parent d767e52138
commit c8644f5dbf
2 changed files with 26 additions and 16 deletions

1
.gitignore vendored
View File

@ -38,5 +38,6 @@ bindings/build
# External libs binaries # External libs binaries
public/*.dylib public/*.dylib
public/*.dll
public/mpv/* public/mpv/*
!public/mpv/.gitkeep !public/mpv/.gitkeep

View File

@ -1,22 +1,31 @@
const { readdirSync, copyFileSync } = require('fs') const { homedir } = require('os')
const { join } = require('path') const { copyFileSync } = require('fs')
const { join, basename } = require('path')
const PUBLIC_DIR = join(__dirname, '..', 'public') const PUBLIC_DIR = join(__dirname, '..', 'public')
const BINDINGS_BUILD_DIR = join(__dirname, '..', 'bindings', 'build', 'Release')
const FILE_NAME = { function moveToPublic (filepath) {
darwin: 'libtorrent-rasterbar.10.dylib', console.log(`[KawAnime] Copying ${filepath} to public directory.`)
win32: 'libtorrent-rasterbar.dll'
}[process.platform] || 'libtorrent-rasterbar.so'
readdirSync(BINDINGS_BUILD_DIR) copyFileSync(
.forEach((file) => { filepath,
if (file !== FILE_NAME) return join(PUBLIC_DIR, basename(filepath))
)
}
console.log(`[KawAnime] Moving ${file} to public directory.`) function linux () {
// TODO
}
copyFileSync( function windows () {
join(BINDINGS_BUILD_DIR, file), const sys32Path = join(homedir().split('\\')[0], 'Windows', 'System32')
join(PUBLIC_DIR, file) const requiredDlls = [
) 'libcrypto-1_1-x64.dll',
}) 'libssl-1_1-x64.dll'
].map((dll) => join(sys32Path, dll))
requiredDlls.forEach(moveToPublic)
}
if (process.platform === 'win32') windows()
else linux()