Skip to content

Commit

Permalink
lua,win: Download lua53.lib to generate yue.dll
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Feb 12, 2018
1 parent 85ee97b commit 0ae8239
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/out/
/third_party/llvm-build/
/third_party/node-*/
/third_party/lua_binaries_*/
/third_party/debian_stretch_amd64-sysroot/
/third_party/debian_stretch_i386-sysroot/
/third_party/debian_stretch_arm-sysroot/
Expand Down
3 changes: 0 additions & 3 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ group("default") {
if (!is_component_build) {
deps += [ "//nativeui:libyue" ]
}
if (!is_win) {
deps += [ "//lua_yue:lua_yue" ]
}
}
9 changes: 8 additions & 1 deletion lua_yue/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ loadable_module("lua_yue") {

deps = [
":lua_yue_gui",
"//third_party/lua", # build lua executable
]

if (is_mac) {
Expand All @@ -46,6 +45,14 @@ loadable_module("lua_yue") {
} else if (is_linux && is_component_build) {
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
} else if (is_win) {
if (current_cpu == "x86") {
libs = [ rebase_path("//third_party/lua_binaries_5.3.4_Win32/lua53.lib") ]
} else if (current_cpu == "x64") {
libs = [ rebase_path("//third_party/lua_binaries_5.3.4_Win64/lua53.lib") ]
}
ldflags = [
"/NODEFAULTLIB:libcmtd.lib",
]
}
}

Expand Down
7 changes: 5 additions & 2 deletions scripts/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ let sysrootArch = {
arm64: 'arm64',
}[targetCpu]

if (process.platform !== 'win32') {
if (process.platform != 'win32') {
execSync('python tools/clang/scripts/update.py')
}
if (process.platform === 'linux') {
if (process.platform == 'win32') {
execSync(`node scripts/download_lua_libs.js 5.3.4 ${targetCpu}`)
}
if (process.platform == 'linux') {
execSync(`python tools/install-sysroot.py --arch ${sysrootArch}`)
}

Expand Down
3 changes: 1 addition & 2 deletions scripts/create_dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ generateZip('libyue', [], yuezip)

// Zip other binaries.
generateZip('yue', exeFiles[targetOs])
if (targetOs != 'win')
generateZip('lua_yue_lua_5.3', luaFiles[targetOs])
generateZip('lua_yue_lua_5.3', luaFiles[targetOs])

// Zip docs, but only do it for linux/x64 when running on CI, to avoid uploading
// docs for multiple times.
Expand Down
41 changes: 41 additions & 0 deletions scripts/download_lua_libs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env node

// Copyright 2018 Cheng Zhao. All rights reserved.
// Use of this source code is governed by the license that can be found in the
// LICENSE file.

const {argv, download, mkdir} = require('./common')

const fs = require('fs')
const path = require('path')
const extract = require('./libs/extract-zip')

if (argv.length != 2) {
console.error('Usage: download_lua_libs version cpu')
process.exit(1)
}

const version = argv[0]
const targetCpu = argv[1]

const arch = targetCpu == 'x64' ? 'Win64' : 'Win32'
const lua_dir = path.resolve('third_party', `lua_binaries_${version}_${arch}`)
if (fs.existsSync(lua_dir)) {
process.exit(0)
}

const mirror = 'https://jaist.dl.sourceforge.net/project/luabinaries'
const folder = 'Windows%20Libraries/Static'
const zipname = `lua-${version}_${arch}_vc14_lib.zip`
const url = `${mirror}/${version}/${folder}/${zipname}`

download(url, (response) => {
mkdir(lua_dir)
const zippath = path.join(lua_dir, zipname)
response.on('end', () => {
extract(zippath, {dir: lua_dir}, (error) => {
fs.unlinkSync(zippath)
})
})
response.pipe(fs.createWriteStream(zippath))
})

0 comments on commit 0ae8239

Please sign in to comment.