comp.lang.ada
 help / color / mirror / Atom feed
From: "Luke A. Guest" <laguest@archeia.com>
Subject: Re: SDL Ada package fails to compile on Mac, gnat 13.1, missing "SDL2_ttf/SDL_ttf.h"
Date: Fri, 30 Jun 2023 14:26:16 +0100	[thread overview]
Message-ID: <u7ml5o$2i3mc$1@dont-email.me> (raw)
In-Reply-To: <u7med9$2hdm3$1@dont-email.me>

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

On 30/06/2023 12:30, Luke A. Guest wrote:
> The /build/gnat gpr's have got a bit confused by the looks of things.
> 
> Can you try this patch, it's made from a stash from a diff branch, if it 
> works I'll apply it and push it.

Ignore that, I forgot something, try this one instead.


[-- Attachment #2: test.patch --]
[-- Type: text/x-patch, Size: 6475 bytes --]

diff --git a/build/gnat/makefile b/build/gnat/makefile
index b13930f..0046490 100644
--- a/build/gnat/makefile
+++ b/build/gnat/makefile
@@ -90,7 +90,7 @@ tests: $(LIB_NAME) tests.gpr $(TESTS_SRCS)
 
 tests.gpr: $(TESTS_SRCS) gen/$(SDL_MODE)/test/libtestmaths.so
 	$(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-		-Ptests.gpr ${SDL2_CONFIG}
+		-Ptests.gpr # ${SDL2_CONFIG}
 
 # Maths library
 
@@ -111,7 +111,7 @@ unit_tests: $(LIB_NAME) build_unit_tests/unit_tests
 
 build_unit_tests/unit_tests:
 	$(GPRMAKE) -p -gnat2012 -XSDL_MODE=$(SDL_MODE) -XSDL_PLATFORM=$(SDL_PLATFORM) \
-		-Punit_tests.gpr ${SDL2_CONFIG}
+		-Punit_tests.gpr # ${SDL2_CONFIG}
 
 .PHONY: clean-unit_tests
 
diff --git a/build/gnat/sdlada.gpr b/build/gnat/sdlada.gpr
index adc77f5..13ef8ee 100644
--- a/build/gnat/sdlada.gpr
+++ b/build/gnat/sdlada.gpr
@@ -1,10 +1,21 @@
 library project SDLAda is
-   type Platform_Type is ("linux", "bsd", "windows", "macosx", "macos_homebrew", "ios", "android");
+   type Platform_Type is ("linux",
+                          "bsd",
+                          "windows",
+                          "macosx",
+                          "macos_homebrew",
+                          "macos_ports",
+                          "ios",
+                          "android");
    type Mode_Type is ("debug", "release");
 
    Platform : Platform_Type := external ("SDL_PLATFORM", "linux");
    Mode     : Mode_Type     := external ("SDL_MODE", "debug");
 
+   package Builder is
+      for Default_Switches ("Ada") use ("-gnat2012", "-gnata");
+   end Builder;
+
    Source_Platform := "";
 
    case Platform is
@@ -52,6 +63,11 @@ library project SDLAda is
                                           "-I/usr/local/include",
                                           "-D_REENTRANT");
 
+         when "macos_ports" =>
+            C_Switches   := C_Switches & ("-DSDL_MACPORTS",
+                                          "-I/opt/local/include",
+                                          "-D_THREAD_SAFE");
+
          when others =>
             null;
       end case;
@@ -59,4 +75,33 @@ library project SDLAda is
       for Default_Switches ("C") use Common_Switches & C_Switches;
       for Default_Switches ("Ada") use Common_Switches & Ada_Switches;
    end Compiler;
+
+   package Linker is
+      Linker_Switches := ();
+
+      case Platform is
+         when "linux" | "bsd" | "android" | "windows" =>
+            Linker_Switches := Linker_Switches & ("-lSDL2",
+                                                  "-lSDL2_ttf",
+                                                  "-lSDL2_image",
+                                                  "-L/usr/lib64");
+
+         when "macos_homebrew" =>
+            Linker_Switches := Linker_Switches & ("-lSDL2",
+                                                  "-lSDL2_ttf",
+                                                  "-lSDL2_image",
+                                                  "-L/usr/local/lib");
+
+         when "macos_ports" =>
+            Linker_Switches := Linker_Switches & ("-lSDL2",
+                                                  "-lSDL2_ttf",
+                                                  "-lSDL2_image",
+                                                  "-L/opt/local/lib");
+
+         when others =>
+            null;
+      end case;
+
+      for Switches ("Ada") use Linker_Switches;
+   end Linker;
 end SDLAda;
diff --git a/build/gnat/sdlada_image.gpr b/build/gnat/sdlada_image.gpr
index 1098095..5a9764f 100644
--- a/build/gnat/sdlada_image.gpr
+++ b/build/gnat/sdlada_image.gpr
@@ -11,4 +11,5 @@ library project SDLAda_Image is
    for Library_Version use "libsdlada_image.so." & Version;
 
    package Compiler renames SDLAda.Compiler;
+   package Linker renames SDLAda.Linker;
 end SDLAda_Image;
diff --git a/build/gnat/tests.gpr b/build/gnat/tests.gpr
index 70dceff..51ee201 100644
--- a/build/gnat/tests.gpr
+++ b/build/gnat/tests.gpr
@@ -15,24 +15,5 @@ project Tests is
                         "ttf.adb");
 
    package Compiler renames SDLAda.Compiler;
-
-   package Linker is
-
-      Linker_Switches := ();
-
-      case Sdlada.Platform is
-         when "macos_homebrew" =>
-            Linker_Switches := Linker_Switches & ("-lSDL2",
-                                                  "-lSDL2_ttf",
-                                                  "-lSDL2_image",
-                                                  "-L/usr/local/lib");
-
-         when others =>
-            null;
-      end case;
-
-      for Switches ("Ada") use Linker_Switches;
-
-   end Linker;
-
+   package Linker renames SDLAda.Linker;
 end Tests;
diff --git a/build/gnat/tests_image.gpr b/build/gnat/tests_image.gpr
index f23be3c..fd68309 100644
--- a/build/gnat/tests_image.gpr
+++ b/build/gnat/tests_image.gpr
@@ -8,6 +8,7 @@ project Tests_Image is
    for Main        use ("load_surface.adb");
 
    package Compiler renames SDLAda.Compiler;
+   package Linker renames SDLAda.Linker;
 
    --     package Builder is
    --        for Default_Switches ("Ada") use ("-gnat2012", "-gnata"); --, "-gnatG");
diff --git a/build/gnat/unit_tests.gpr b/build/gnat/unit_tests.gpr
index c469a34..27dd38f 100644
--- a/build/gnat/unit_tests.gpr
+++ b/build/gnat/unit_tests.gpr
@@ -17,4 +17,5 @@ project Unit_Tests is
    -- end Ide;
 
    package Compiler renames SDLAda.Compiler;
+   package Linker renames SDLAda.Linker;
 end Unit_Tests;
diff --git a/src/image/version_images.c b/src/image/version_images.c
index ba5be68..47813a1 100644
--- a/src/image/version_images.c
+++ b/src/image/version_images.c
@@ -21,7 +21,7 @@
  *    distribution.
  **********************************************************************************************************************/
 #ifdef __APPLE__
-    #ifdef SDL_HOMEBREW
+    #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS)
         #include <SDL2/SDL_image.h>
     #else
         #include <SDL2_image/SDL_image.h>
diff --git a/src/ttf/version_ttf.c b/src/ttf/version_ttf.c
index cedfebc..0819103 100644
--- a/src/ttf/version_ttf.c
+++ b/src/ttf/version_ttf.c
@@ -21,7 +21,7 @@
  *    distribution.
  **********************************************************************************************************************/
 #ifdef __APPLE__
-    #ifdef SDL_HOMEBREW
+    #if defined (SDL_HOMEBREW) || defined (SDL_MACPORTS)
         #include <SDL2/SDL_ttf.h>
     #else
         #include <SDL2_ttf/SDL_ttf.h>

  reply	other threads:[~2023-06-30 13:26 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 18:38 SDL Ada package fails to compile on Mac, gnat 13.1, missing "SDL2_ttf/SDL_ttf.h" Kenneth Wolcott
2023-06-28 21:13 ` Luke A. Guest
2023-06-28 21:18   ` Kenneth Wolcott
2023-06-28 21:53     ` Kenneth Wolcott
2023-06-28 22:45       ` Luke A. Guest
2023-06-29  0:17         ` Kenneth Wolcott
2023-06-29  9:50           ` Luke A. Guest
2023-06-29 13:12       ` Simon Wright
2023-06-29 13:39         ` Luke A. Guest
2023-06-29 16:06           ` Simon Wright
2023-06-29 17:34             ` Kenneth Wolcott
2023-06-29 19:35               ` Luke A. Guest
2023-06-29 22:04                 ` Kenneth Wolcott
2023-06-30  8:04                   ` Luke A. Guest
2023-06-30 15:41                     ` Kenneth Wolcott
2023-06-30 15:43                       ` Luke A. Guest
2023-06-30 11:30                   ` Luke A. Guest
2023-06-30 13:26                     ` Luke A. Guest [this message]
2023-07-02  7:01                       ` Luke A. Guest
2023-07-02 17:05                         ` Kenneth Wolcott
2023-07-02 19:23                           ` Simon Wright
2023-07-02 19:26                             ` Kenneth Wolcott
2023-07-02 19:52                               ` Luke A. Guest
2023-07-02 20:20                                 ` Kenneth Wolcott
2023-07-02 21:34                                   ` Kenneth Wolcott
2023-07-02 21:40                                   ` Luke A. Guest
2023-07-02 21:59                                     ` Kenneth Wolcott
2023-07-03 12:23                                       ` Luke A. Guest
2023-07-03 19:58                                         ` Kenneth Wolcott
2023-07-03 20:10                                           ` Luke A. Guest
2023-07-03 20:11                                           ` Luke A. Guest
2023-07-03 22:56                                             ` Kenneth Wolcott
2023-07-03 23:01                                               ` Kenneth Wolcott
2023-07-03 23:10                                                 ` Kenneth Wolcott
2023-07-03 23:24                                                   ` Keith Thompson
2023-07-03 23:58                                                     ` Kenneth Wolcott
2023-07-04  9:00                                                       ` Luke A. Guest
2023-07-06 19:37                                                         ` Kenneth Wolcott
2023-07-07  1:23                                                           ` Kenneth Wolcott
2023-07-07  1:25                                                             ` Kenneth Wolcott
2023-07-12  5:43                                                               ` Kenneth Wolcott
2023-07-12  6:01                                                                 ` Kenneth Wolcott
2023-07-12 15:44                                                                   ` Luke A. Guest
2023-07-12 23:09                                                                     ` Kenneth Wolcott
2023-07-12 23:11                                                                       ` Kenneth Wolcott
2023-07-13 10:59                                                                         ` Luke A. Guest
2023-07-13 14:14                                                                           ` Rod Kay
2023-07-13 15:15                                                                             ` Kenneth Wolcott
2023-07-04  8:59                                                     ` Luke A. Guest
2023-07-04  8:57                                                 ` Luke A. Guest
2023-06-29 21:22               ` Simon Wright
2023-06-29 22:12                 ` Kenneth Wolcott
2023-06-29 19:29             ` Luke A. Guest
2023-06-29 11:33     ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox