From 562888b62d709383f5ef6750c98b204104ea6003 Mon Sep 17 00:00:00 2001 From: Joseph Aquino Date: Fri, 2 Jan 2026 14:36:05 -0500 Subject: [PATCH] fix flac and ogg scripts so that the project can be built within a docker containter --- premake-scripts/build-flac.lua | 1 + premake-scripts/build-ogg.lua | 44 ++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/premake-scripts/build-flac.lua b/premake-scripts/build-flac.lua index 14b0df1..8b1ee4d 100644 --- a/premake-scripts/build-flac.lua +++ b/premake-scripts/build-flac.lua @@ -36,6 +36,7 @@ function m.generateproject(liboutdir, intdir) "FLAC__NO_DLL", "CPU_IS_BIG_ENDIAN=0", "FLAC__HAS_OGG=1", + "HAVE_INTTYPES_H", "PACKAGE_VERSION=\"\"", } diff --git a/premake-scripts/build-ogg.lua b/premake-scripts/build-ogg.lua index 4981052..6236b16 100644 --- a/premake-scripts/build-ogg.lua +++ b/premake-scripts/build-ogg.lua @@ -2,6 +2,42 @@ local m = {} 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 + + 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) project"ogg" language"C" -- c++ will mangle names and sfml wont build @@ -10,7 +46,11 @@ function m.generateproject(liboutdir, intdir) objdir(intdir) 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 { @@ -25,4 +65,4 @@ function m.link() includedirs{path.join(rootdir, "ogg/include")} end -return m \ No newline at end of file +return m