Package: libgtkada / 3.8.3-1

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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Description: allow caller to override build flags
 configure.in: accept ADAFLAGS like CFLAGS and friends, and transmit
 all of them to generated files. This part has been refused upstream,
 because it may be replaced with appropriate GPRBUILD_OPTIONS
 and would encourage users to use untested combinations.
 .
 Makefile.in: allow user to override default gprbuild options.
 .
 Builder options in shared.gpr.in (-jPROCESSORS -m -p) override the
 same settings in Makefile.in. For example, "make PROCESSORS=2" is
 silently ignored. One of them has to disappear.
 .
 shared.gpr.in *.gpr: *FLAGS given to configure should be able to
 override default *switches in projects. Refused upstream, see above.
 .
 Set Library_Options in opengl.gpr, as in upstream commit
 https://github.com/AdaCore/gtkada/commit/77ce088e84b9d1a2de2ed78c5d7d30596ba33579#diff-ab95eddae77bed1dc4a1ef6544cbdaef.
 .
 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: https://github.com/AdaCore/gtkada/commit/901a766ce2b4bf4fcda25178a8c95774762da9ad

--- a/configure.in
+++ b/configure.in
@@ -7,6 +7,13 @@
 fi
 AC_SUBST(TARGET)
 
+AC_ARG_VAR(ADAFLAGS,Debugging and optimization options for the Ada compiler)
+AM_TO_GPR( $ADAFLAGS,  ADAFLAGS_GPR)
+AM_TO_GPR(   $CFLAGS,    CFLAGS_GPR)
+AM_TO_GPR( $CPPFLAGS,  CPPFLAGS_GPR)
+AM_TO_GPR(  $LDFLAGS,   LDFLAGS_GPR)
+AM_TO_GPR($OBJCFLAGS, OBJCFLAGS_GPR)
+
 AM_ADD_OS_SPECIFIC_FLAGS
 
 # checking for local tools
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,7 +32,8 @@
 # Number of parallel compilation
 PROCESSORS   = 0
 
-GPRBUILD_FULL = ${GPRBUILD} -j${PROCESSORS} -m -p
+GPRBUILD_OPTIONS =
+GPRBUILD_FULL = ${GPRBUILD} -j${PROCESSORS} -m -p ${GPRBUILD_OPTIONS}
 
 GETTEXT_INTL=@GETTEXT_INTL@
 HAVE_GETTEXT=@HAVE_GETTEXT@
--- a/shared.gpr.in
+++ b/shared.gpr.in
@@ -3,9 +3,6 @@
    type Build_Type is ("Debug", "Production");
    Build : Build_Type := external ("BUILD", "@BUILD_TYPE@");
 
-   Processors := external ("PROCESSORS", "0");
-   --  Number of parallel compilations that should be performed
-
    type Boolean_Type is ("True", "False");
    Build_Opengl : Boolean_Type := "@HAVE_OPENGL@";
 
@@ -19,6 +16,11 @@
 
    So_Ext := "@SO_EXT@";
    Version := "@PACKAGE_VERSION@";
+   Adaflags    := (@ADAFLAGS_GPR@);
+   Cflags      := (@CFLAGS_GPR@);
+   Cppflags    := (@CPPFLAGS_GPR@);
+   Ldflags     := (@LDFLAGS_GPR@);
+   Objcflags   := (@OBJCFLAGS_GPR@);
    Gtk_Include := (@GTK_CFLAGS_GPR@);
    Gtk_Libs    := (@GTK_LIBS_GPR@);
    GL_Include  := (@GL_CFLAGS_GPR@);
@@ -45,14 +47,16 @@
                  "-Werror=format-security");
              for Switches ("C") use ("-O2");
       end case;
+      for Switches ("Ada") use Compiler'Switches ("Ada") & Adaflags;
+      for Switches ("C") use Compiler'Switches ("C") & Cppflags & Cflags;
+      for Switches ("Objective-C") use Compiler'Switches ("Objective-C")
+        & Objcflags;
 
       for Switches ("C") use Compiler'Switches ("C") & Gtk_Include;
       for Switches ("Objective-C") use Compiler'Switches ("Objective-C") & Gtk_Include;
    end Compiler;
 
    package Builder is
-      for Switches ("Ada") use ("-m", "-j" & Processors);
-
       case Build is
          when "Debug" =>
             for Global_Configuration_Pragmas use Shared'Project_Dir & "src/gnat_debug.adc";
@@ -70,6 +74,10 @@
       end case;
    end Binder;
 
+   package Linker is
+      for Leading_Switches ("Ada") use Ldflags;
+   end Linker;
+
    package IDE is
       for VCS_Kind use "auto";
       for Documentation_Dir use "html";
--- a/src/gtkada_src.gpr
+++ b/src/gtkada_src.gpr
@@ -16,6 +16,7 @@
    for Library_Name use "gtkada";
    for Library_Version use
       "lib" & Project'Library_Name & Shared.So_Ext & "." & Shared.Version;
+   for Leading_Library_Options use Shared.Ldflags;
    for Library_Options use Shared.Gtk_Libs;
 
    package Builder  renames Shared.Builder;
--- a/src/opengl/opengl.gpr
+++ b/src/opengl/opengl.gpr
@@ -16,6 +16,8 @@
    for Library_Dir use "../lib/" & Project'Library_Name & "/" & Project'Library_Kind;
    for Library_Version use
       "lib" & Project'Library_Name & Shared.So_Ext & "." & Shared.Version;
+   for Leading_Library_Options use Shared.Ldflags;
+   for Library_Options use Shared.GL_Libs;
 
    package Builder  renames Shared.Builder;
    package Compiler is
@@ -30,4 +32,3 @@
       for Linker_Options use Shared.GL_Libs;
    end Linker;
 end OpenGL;
-
--- a/src/tools/tools.gpr
+++ b/src/tools/tools.gpr
@@ -12,5 +12,6 @@
 
    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
@@ -30,6 +30,7 @@
       for Switches ("C") use Shared.Compiler'Switches ("C");
    end Compiler;
    package Binder   renames Shared.Binder;
+   package Linker   renames Shared.Linker;
    package IDE      renames Shared.IDE;
 
 end TestGtk;
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -88,7 +88,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
@@ -274,15 +274,11 @@
     if test $? != 0 ; then
        AC_MSG_ERROR([old version detected])
     fi
-    
+
     GTK_PREFIX=`$PKG_CONFIG $GTK --variable=prefix`
     GTK_CFLAGS=`$PKG_CONFIG $GTK --cflags`
     GTK_LIBS=`$PKG_CONFIG $GTK gmodule-2.0 --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
@@ -325,6 +321,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
 ])