Skip to content

Commit

Permalink
Merge branches 'fixes' and 'bugfixes' into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Sep 7, 2023
3 parents 11fece4 + 4f67db8 + 4b6845a commit bf3a2a7
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libaegisub/common/charset_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ size_t IconvWrapper::DstStrLen(const char* str) {
bool IsConversionSupported(const char *src, const char *dst) {
iconv_t cd = iconv_open(dst, src);
bool supported = cd != iconv_invalid;
iconv_close(cd);
if (supported) iconv_close(cd);
return supported;
}

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ if host_machine.system() == 'windows'
link_depends += manifest_file
endif

aegisub = executable('aegisub', aegisub_src, version_h, acconf,
aegisub = executable('aegisub', aegisub_src, version_h, acconf, resrc,
link_with: [libresrc, libluabins, libaegisub],
link_args: link_args,
link_depends: link_depends,
Expand Down
45 changes: 45 additions & 0 deletions subprojects/packagefiles/luajit/src/host/genversion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
----------------------------------------------------------------------------
-- Lua script to embed the rolling release version in luajit.h.
----------------------------------------------------------------------------
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------

local args = {...}
local FILE_ROLLING_H = args[1] or "luajit_rolling.h"
local FILE_RELVER_TXT = args[2] or "luajit_relver.txt"
local FILE_LUAJIT_H = args[3] or "luajit.h"

local function file_read(file)
local fp = assert(io.open(file, "rb"), "run from the wrong directory")
local data = assert(fp:read("*a"))
fp:close()
return data
end

local function file_write_mod(file, data)
local fp = io.open(file, "rb")
if fp then
local odata = assert(fp:read("*a"))
fp:close()
if odata == data then return end
end
fp = assert(io.open(file, "wb"))
assert(fp:write(data))
assert(fp:close())
end

local text = file_read(FILE_ROLLING_H)
local relver = file_read(FILE_RELVER_TXT):match("(%d+)")

if relver then
text = text:gsub("ROLLING", relver)
else
io.stderr:write([[
**** WARNING Cannot determine rolling release version from git log.
**** WARNING The 'git' command must be available during the build.
]])
file_write_mod(FILE_RELVER_TXT, "ROLLING\n") -- Fallback for install target.
end

file_write_mod(FILE_LUAJIT_H, text)
6 changes: 1 addition & 5 deletions subprojects/packagefiles/luajit/src/host/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
minilua = executable('minilua', 'minilua.c',
dependencies: system_deps,
native: true)

cpu_family = host_machine.cpu_family()
if cpu_family == 'x86_64'
dynasm_arch = 'x64'
Expand Down Expand Up @@ -54,7 +50,7 @@ buildvm_arch = custom_target('buildvm_arch.h',
input: dynasm_dasc,
output: 'buildvm_arch.h')

buildvm = executable('buildvm', buildvm_src, buildvm_arch,
buildvm = executable('buildvm', buildvm_src, buildvm_arch, luajit_h,
dependencies: system_deps,
include_directories: src_inc,
native: true)
1 change: 1 addition & 0 deletions subprojects/packagefiles/luajit/src/luajit_relver.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@VCS_CT@
20 changes: 19 additions & 1 deletion subprojects/packagefiles/luajit/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ ljcore_src = files(

src_inc = include_directories('.')

minilua = executable('minilua', 'host/minilua.c',
dependencies: system_deps,
native: true)

relver = vcs_tag(command: ['git', 'show', '-s', '--format=%ct'],
fallback: 'ROLLING',
input: 'luajit_relver.txt.in',
output: 'luajit_relver.txt',
replace_string: '@VCS_CT@')

luajit_rolling_h = files('luajit_rolling.h')

luajit_h = custom_target('luajit_h',
command: [minilua, '@INPUT@', '@OUTPUT@'],
input: ['host/genversion.lua', 'luajit_rolling.h', relver],
output: 'luajit.h')

subdir('host')

hdrgen = [
Expand All @@ -84,7 +101,8 @@ hdrgen = [
'recdef',
]

genheaders = []
genheaders = [luajit_h]

foreach h: hdrgen
genheaders += custom_target(h,
command: [buildvm, '-m', h, '-o', '@OUTPUT@', ljlib_src],
Expand Down

0 comments on commit bf3a2a7

Please sign in to comment.