fix flac and ogg scripts so that the project can be built within a docker containter

This commit is contained in:
Joseph Aquino 2026-01-02 14:36:05 -05:00
parent e4a039bb87
commit 562888b62d
2 changed files with 43 additions and 2 deletions

View File

@ -36,6 +36,7 @@ function m.generateproject(liboutdir, intdir)
"FLAC__NO_DLL", "FLAC__NO_DLL",
"CPU_IS_BIG_ENDIAN=0", "CPU_IS_BIG_ENDIAN=0",
"FLAC__HAS_OGG=1", "FLAC__HAS_OGG=1",
"HAVE_INTTYPES_H",
"PACKAGE_VERSION=\"\"", "PACKAGE_VERSION=\"\"",
} }

View File

@ -2,6 +2,42 @@ local m = {}
local rootdir = path.join(path.getabsolute(path.getdirectory(_SCRIPT)), "../") local rootdir = path.join(path.getabsolute(path.getdirectory(_SCRIPT)), "../")
local function generate_config_header(include_dir)
local output_file = path.join(include_dir, "ogg/config_types.h")
-- Only generate if it doesn't exist to avoid rebuilding every time
if os.isfile(output_file) then return end
print("Generating " .. output_file)
-- "Modern" config_types.h content that uses stdint.h (works on 32 and 64 bit)
local content = [[
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__
/* Generated automatically by Premake script */
#include <stdint.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
typedef uint64_t ogg_uint64_t;
#endif
]]
local f = io.open(output_file, "w")
if f then
f:write(content)
f:close()
else
print("Error: Failed to write to " .. output_file)
end
end
function m.generateproject(liboutdir, intdir) function m.generateproject(liboutdir, intdir)
project"ogg" project"ogg"
language"C" -- c++ will mangle names and sfml wont build language"C" -- c++ will mangle names and sfml wont build
@ -10,7 +46,11 @@ function m.generateproject(liboutdir, intdir)
objdir(intdir) objdir(intdir)
warnings"Off" warnings"Off"
includedirs {path.join(rootdir, "ogg/include")} local include_path = path.join(rootdir, "ogg/include")
generate_config_header(include_path)
includedirs {include_path}
files files
{ {
@ -25,4 +65,4 @@ function m.link()
includedirs{path.join(rootdir, "ogg/include")} includedirs{path.join(rootdir, "ogg/include")}
end end
return m return m