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: Sun, 2 Jul 2023 20:52:51 +0100	[thread overview]
Message-ID: <u7skij$3d9vl$1@dont-email.me> (raw)
In-Reply-To: <016412bf-0247-466b-add9-8b5d41c6a9d7n@googlegroups.com>

On 02/07/2023 20:26, Kenneth Wolcott wrote:

>> Google Groups has suppressed Luke's two posts with attached patches.
> 
> Well, that's a very logical explanation for me not seeing anything to respond to :-)

Friggin' goggle. It's this (within the source dir - patch --dry-run -p1 
< test.patch):

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-07-02 19:52 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
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 [this message]
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