Package: libgtkada / 18-2

build-flags.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Description: allow caller to override build flags
 Upstream has refused to set CFLAGS and friends from ./configure.
 .
 aclocal.m4: LDFLAGS should be extended, neither erased nor inserted
 into GTK_LIBS. LIBS should be appended to GTK_LIBS instead of
 prepended (to be compatible with --Wl,--as-needed).
Author: Nicolas Boulenguez <nicolas@debian.org>
Forwarded: not-needed

--- a/shared.gpr.in
+++ b/shared.gpr.in
@@ -69,6 +69,12 @@
              for Switches ("C") use ("-O2");
       end case;
 
+      Adaflags := External_As_List ("ADAFLAGS", " ");
+      for Switches ("Ada") use Compiler'Switches ("Ada") & Adaflags;
+      Cppflags := External_As_List ("CPPFLAGS", " ");
+      Cflags   := External_As_List ("CFLAGS", " ");
+      for Switches ("C") use Compiler'Switches ("C") & Cppflags & Cflags;
+
       for Switches ("C") use Compiler'Switches ("C") & Gtk_Include;
       for Switches ("Objective-C") use Compiler'Switches ("Objective-C") & Gtk_Include;
    end Compiler;
@@ -93,6 +99,11 @@
       end case;
    end Binder;
 
+   Ldflags := External_As_List ("LDFLAGS", " ");
+   package Linker is
+      for Leading_Switches ("Ada") use Ldflags;
+   end Linker;
+
    package IDE is
       for VCS_Kind use "auto";
    end IDE;
--- a/src/gtkada.gpr
+++ b/src/gtkada.gpr
@@ -62,6 +62,7 @@
 
    case Shared.Library_Kind is
       when "relocatable" =>
+         for Leading_Library_Options use Shared.Ldflags;
          for Library_Options use Shared.Gtk_Libs;
       when others =>
          null;
--- a/src/opengl/gtkada_gl.gpr
+++ b/src/opengl/gtkada_gl.gpr
@@ -42,6 +42,7 @@
 
    case Shared.Library_Kind is
       when "relocatable" =>
+         for Leading_Library_Options use Shared.Ldflags;
          for Library_Options use Shared.GL_Libs & Shared.Gtk_Libs;
       when others =>
          null;
--- a/src/tools/tools.gpr
+++ b/src/tools/tools.gpr
@@ -35,6 +35,7 @@
 
    package Compiler renames Shared.Compiler;
    package Binder   renames Shared.Binder;
+   package Linker   renames Shared.Linker;
    package IDE      renames Shared.IDE;
 
 end Tools;
--- a/testgtk/testgtk.gpr
+++ b/testgtk/testgtk.gpr
@@ -35,8 +35,12 @@
 
    package Compiler is
       --  subprogram specs not required in testgtk
-      for Switches ("Ada") use ("-g", "-O0", "-gnaty-s", "-gnatwJ");
+      for Switches ("Ada") use ("-g", "-O0", "-gnaty-s", "-gnatwJ")
+        & External_As_List ("ADAFLAGS", " ");
    end Compiler;
+   package Linker is
+      for Leading_Switches ("Ada") use External_As_List("LDFLAGS", " ");
+   end Linker;
 
    package Install is
       for artifacts ("share/examples/gtkada/testgtk") use
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -101,7 +101,7 @@
          BUILD_SHARED=yes
       fi
       SO_OPTS="-Wl,-undefined,dynamic_lookup -dynamiclib -Wl,-dylib_install_name,"
-      LDFLAGS="-Wl,-framework,Cocoa"
+      LDFLAGS="$LDFLAGS -Wl,-framework,Cocoa"
       TARGET_LFLAGS="-Wl,-framework,Cocoa"
       ;;
    # ??? The following case has been introduced because of an elaboration
@@ -281,10 +281,6 @@
     GTK_CFLAGS=`$PKG_CONFIG $GTK --cflags`
     GTK_LIBS=`$PKG_CONFIG $GTK gmodule-2.0 fontconfig --libs`
 
-    dnl force some explicit flags, like -framework Cocoa. On some machines,
-    dnl these are added automatically by pkg-config, but not systematically.
-    GTK_LIBS="$GTK_LIBS $LDFLAGS"
-
     dnl
     dnl Now check if the installed GTK is sufficiently new. (Also sanity
     dnl checks the results of pkg-config to some extent
@@ -327,6 +323,8 @@
      *mingw*) GTK_LIBS="-L../../lib -L../../bin $GTK_LIBS";;
   esac
 
+  GTK_LIBS="$GTK_LIBS $LIBS"
+
   AM_TO_GPR($GTK_LIBS, GTK_LIBS_GPR)
   rm -f conf.gtktest
 ])