From a00d4ba144047080bfec1ce5c1983a933b336001 Mon Sep 17 00:00:00 2001 From: IoI_xD Date: Tue, 31 Mar 2026 16:54:01 -0700 Subject: [PATCH] configure updates, new 'tiny config' option --- configure | 27 ++++++++++++++++++--------- include/Mw/LowLevel/Wayland.h | 3 +-- include/Mw/MachDep.h | 6 ++++++ pl/rules.pl | 8 +++++++- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 296eef9..2acabea 100755 --- a/configure +++ b/configure @@ -15,7 +15,7 @@ our $cc = defined($ENV{CC}) ? $ENV{CC} : "*host*gcc"; our $ar = defined($ENV{AR}) ? $ENV{AR} : "*host*ar"; our $incdir = "-I include"; our $incdir2 = ""; -our $cflags = "-fPIC -D_MILSKO"; +our $cflags = "-fPIC -D_MILSKO -fvisibility=hidden"; our $libdir = ""; our $ldflags = ""; our $math = "-lm"; @@ -46,18 +46,12 @@ param_set("vulkan-string-helper", 1); param_set("shared", 1); param_set("static", 1); param_set("examples", 1); -if($target eq "Linux") { - param_set("x11", 1); -} -if($target eq "Linux") { - param_set("wayland", 1); -} + if($target ne "Darwin") { param_set("freetype2", 1); } - my %features = ( "classic-theme" => "use classic theme", "stb-image" => "use stb_image, instead use libjpeg/libpng", @@ -77,7 +71,7 @@ my @features_keys = ( "1opengl", "2xrender", "1vulkan", "2vulkan-string-helper", "1shared", "1static", - "1wayland" + "1wayland", ); foreach my $l (@ARGV) { @@ -96,9 +90,15 @@ foreach my $l (@ARGV) { elsif ($l =~ /^--host=(.+)$/) { $host = $1 . "-"; } + elsif ($l =~ /^--cflags=(.+)$/) { + add_cflags($1); + } elsif ($l eq "--cross") { $cross = 1; } + elsif ($l eq "--tiny") { + param_set("tiny",1); + } elsif (($l eq "-h") or ($l eq "--help")) { print("Milsko Toolkit Configuration Utility\n"); print("\n"); @@ -109,6 +109,8 @@ foreach my $l (@ARGV) { print(" --prefix=PREFIX Installation prefix\n"); print(" --host=TARGET Host for compiler/archiver\n"); print(" --target=TARGET Specify target\n"); + print(" --cflags=CFLAGS Add cflags\n"); + print(" --tiny Build smallest possible library\n"); print(" --cross Indicate cross compilation\n"); print("\n"); print("Features:\n"); @@ -134,6 +136,13 @@ foreach my $l (@ARGV) { } } +if($target eq "Linux") { + param_set("x11", 1); + if(!param_get("tiny")){ + param_set("wayland", 1); + } +} + if (-f "./pl/ostype/${target}.pl") { require("./pl/ostype/${target}.pl"); } diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index 592da29..7b31bd7 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -1,8 +1,7 @@ /*! * @file Mw/LowLevel/Wayland.h - * @brief Work in progress Wayland Backend + * @brief Wayland Backend * @warning This is used internally. - * @warning This is disabled by default. */ #ifndef __MW_LOWLEVEL_WAYLAND_H__ #define __MW_LOWLEVEL_WAYLAND_H__ diff --git a/include/Mw/MachDep.h b/include/Mw/MachDep.h index bc34270..61a6f90 100644 --- a/include/Mw/MachDep.h +++ b/include/Mw/MachDep.h @@ -61,6 +61,12 @@ #define MWDECL extern __declspec(dllexport) #elif defined(_WIN32) #define MWDECL extern __declspec(dllimport) +#elif defined(__has_attribute) +#if __has_attribute(visibility) +#define MWDECL extern __attribute__((visibility("default"))) +#else +#define MWDECL extern +#endif #else #define MWDECL extern #endif diff --git a/pl/rules.pl b/pl/rules.pl index c968e28..46810c7 100644 --- a/pl/rules.pl +++ b/pl/rules.pl @@ -1,7 +1,9 @@ new_object("src/*.c"); my $gl_libs = ""; - +if (param_get("tiny")) { + add_cflags("-Oz"); +} if (param_get("classic-theme")) { add_cflags("-DUSE_CLASSIC_THEME"); } @@ -62,6 +64,10 @@ if (grep(/^cocoa$/, @backends)) { if (param_get("stb-image")) { add_cflags("-DUSE_STB_IMAGE"); + if(param_get("tiny")) { + add_cflags("-DSTB_IMAGE_STATIC"); + add_cflags("-DSTB_IMAGE_IMPLEMENTATION"); + } } else { new_object("external/libjpeg/src/*.c");