-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
zipada.gpr
224 lines (190 loc) · 8.1 KB
/
zipada.gpr
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
-- This is a GNAT, GCC or GNAT Studio project file
-- for the Zip-Ada project:
--
-- Home page: http://unzip-ada.sf.net/
-- Project page: http://sf.net/projects/unzip-ada/
-- Mirror: https://github.com/zertovitch/zip-ada
-- Alire crate: https://alire.ada.dev/crates/zipada
--
-- Build me with "gprbuild -P zipada", or "gnatmake -P zipada",
-- or open me with GNAT Studio.
--
-- Important:
-- For building tests, see the zipada_test.gpr project file.
-- For building a shared library, see the zipada_lib.gpr project file.
--
project ZipAda is
type Zip_Build_Mode_Type is
("Debug",
"Fast",
"Fast_Unchecked", -- Faster, at the price of less safety.
"Small",
"Profiling",
"Coverage");
Zip_Build_Mode : Zip_Build_Mode_Type := external ("Zip_Build_Mode", "Fast");
for Create_Missing_Dirs use "True"; -- Flips by default the "-p" switch
for Main use
(-- Tools
"zipada.adb",
"unzipada.adb",
"comp_zip.adb",
"find_zip.adb",
"rezip.adb",
"zip_dir_list.adb",
-- Miscellaneous
"touch2.adb",
"bzip2_dec", -- Standalone BZip2 decoder for .bz2 files
"bzip2_enc", -- Standalone BZip2 encoder for .bz2 files
"lzma_dec", -- Standalone LZMA decoder for .lzma files
"lzma_enc"); -- Standalone LZMA encoder for .lzma files
for Source_Dirs use ("zip_lib", "extras", "tools", "demo");
for Exec_Dir use ".";
case Zip_Build_Mode is
when "Fast" => for Object_Dir use "obj/fast";
when "Fast_Unchecked" => for Object_Dir use "obj/fast_unchecked";
when "Small" => for Object_Dir use "obj/small";
when "Profiling" => for Object_Dir use "obj/profiling";
when "Coverage" => for Object_Dir use "obj/cov";
when others => for Object_Dir use "obj/dbg";
end case;
Compiler_Common_Options :=
("-gnatwa", -- Warnings switches (a:turn on all info/warnings marked with +)
"-gnatwh", -- Warnings switches (h:turn on warnings for hiding declarations)
"-gnatwCijkmopruvz.c.p.t.w.x", -- Warnings switches (run "gnatmake" for full list)
"-gnatf", -- Full errors. Verbose details, all undefined references
"-gnatq", -- Don't quit, try semantics, even if parse errors
"-gnatQ", -- Don't quit, write ali/tree file even if compile errors
"-g"); -- Generate debugging information
Style_Checks :=
("-gnatyaknpr", -- Style: check all casings: a:attribute, k:keywords, n:package Standard identifiers, p:pragma, r:identifier references
"-gnatybfhiu", -- Style: check b:no blanks at end of lines, f:no ff/vtabs, h: no htabs, i:if-then layout, u:no unnecessary blank lines
"-gnatyO", -- Style: check that overriding subprograms are explicitly marked as such.
"-gnatyx", -- Style: check x:no extra parens
"-gnatye", -- Style: check e:end/exit labels present
"-gnatyM120", -- Style: check M:line length <= nn characters
"-gnatytc"); -- Style: check t:token separation rules, c:comment format (two spaces)
type Zip_Styles_Checks_Type is ("Off", "On");
Zip_Styles_Checks : Zip_Styles_Checks_Type := external ("Zip_Styles_Checks", "On");
case Zip_Styles_Checks is
when "Off" => null;
when "On" => Compiler_Common_Options := Compiler_Common_Options & Style_Checks;
end case;
Compiler_Debug_Options :=
Compiler_Common_Options &
("-gnatVa", -- Turn on all validity checking options
"-gnato", -- Enable overflow checking in STRICT (-gnato1) mode
"-gnata", -- Assertions enabled. Pragma Assert and pragma Debug to be activated.
"-fno-inline", "-fstack-check");
Compiler_Fast_Options_Inlining_Neutral :=
Compiler_Common_Options &
("-O2", -- -Ofast: issue with 11.3.1 20220922 / GNAT 23.2
"-fipa-cp-clone",
"-fgcse-after-reload",
"-funroll-loops",
"-fpeel-loops",
"-funswitch-loops",
"-ftracer",
"-fweb",
"-ftree-vectorize",
"-frename-registers",
"-ffunction-sections",
"-fdata-sections");
Compiler_Fast_Options :=
Compiler_Fast_Options_Inlining_Neutral &
("-gnatn"); -- Cross-unit inlining
Compiler_Fast_Unchecked_Options :=
Compiler_Fast_Options &
("-gnatp");
type Zip_OS_Kind is
("Win32", "Win64", "Linux", "MacOSX", "Any");
Zip_OS : Zip_OS_Kind := external ("Zip_OS", "Any");
package Compiler is
case Zip_Build_Mode is
when "Debug" =>
for Local_Configuration_Pragmas use project'Project_Dir & "debug.pra";
for Default_Switches ("ada") use Compiler_Debug_Options ;
when "Fast" =>
case Zip_OS is
when "Win32" | "Win64" =>
for Default_Switches ("ada") use
Compiler_Fast_Options & ("-mfpmath=sse", "-msse3");
when others =>
for Default_Switches ("ada") use Compiler_Fast_Options;
end case;
when "Fast_Unchecked" =>
case Zip_OS is
when "Win32" | "Win64" =>
for Default_Switches ("ada") use
Compiler_Fast_Unchecked_Options & ("-mfpmath=sse", "-msse3");
when others =>
for Default_Switches ("ada") use Compiler_Fast_Unchecked_Options;
end case;
when "Small" =>
for Default_Switches ("ada") use
Compiler_Common_Options & (
"-Os", "-gnatp",
"-ffunction-sections"
);
when "Profiling" =>
for Default_Switches ("ada") use
Compiler_Fast_Options_Inlining_Neutral & ("-fno-inline", "-pg");
when "Coverage" =>
for Default_Switches ("ada") use
Compiler_Common_Options & ("-fprofile-arcs", "-ftest-coverage");
end case;
end Compiler;
package Binder is
-- -Es: Store tracebacks in exception occurrences, and enable symbolic tracebacks
for Default_Switches ("ada") use ("-Es");
end Binder;
Linker_Common_Options := ("-g");
case Zip_OS is
when "Win32" | "Win64" =>
Linker_Common_Options :=
Linker_Common_Options & ("-Xlinker", "--stack=0x2000000,0x20000");
when others =>
null;
end case;
case Zip_OS is
when "Win64" =>
Linker_Common_Options :=
Linker_Common_Options & ("extras/zip_icons.rbj");
when others =>
null;
end case;
package Linker is
case Zip_Build_Mode is
when "Fast" | "Fast_Unchecked" =>
case Zip_OS is
when "MacOSX" =>
for Default_Switches ("ada") use ("-Wl,-dead_strip") & Linker_Common_Options;
when others =>
for Default_Switches ("ada") use ("-Wl,--gc-sections") & Linker_Common_Options;
end case;
when "Small" =>
case Zip_OS is
when "MacOSX" =>
for Default_Switches ("ada") use ("-s", "-Wl,-dead_strip") & Linker_Common_Options;
when others =>
for Default_Switches ("ada") use ("-s", "-Wl,--gc-sections") & Linker_Common_Options;
end case;
when "Profiling" => for Default_Switches ("ada") use ("-pg") & Linker_Common_Options;
when "Coverage" => for Default_Switches ("ada") use ("-fprofile-arcs") & Linker_Common_Options;
when others => for Default_Switches ("ada") use Linker_Common_Options;
end case;
end Linker;
package Builder is
-- "If -j0 is used, then the maximum number of simultaneous compilation
-- jobs is the number of core processors on the platform."
for Default_Switches ("ada") use ("-j0");
end Builder;
package Ide is
for Default_Switches ("adacontrol") use ("-f", "tools/verif.aru", "-r");
for Vcs_Kind use "Subversion";
end Ide;
package Pretty_Printer is
for Default_Switches ("Ada") use (
"--indentation=2"
);
end Pretty_Printer;
end ZipAda;