Skip to content

Commit 1a163b8

Browse files
Jicquellambourg
authored andcommitted
Do not include gnatcoll-projects related package for cross environments
Gnatcoll "projects" features are not required by all use cases, like for the cross environment, and adds dependency towards GPR. This commit moves these features in a sub directory, which is added as a source directory when GNATCOLL_PROJECTS environment variable is set to "yes" (which is the default value). Issue: gnatcoll-core#12 Change-Id: Id27813df9f477766717553c0a91be834b250dabf
1 parent eefda4d commit 1a163b8

14 files changed

+32
-6
lines changed

Makefile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@
4343
#
4444
# Project specific:
4545
#
46-
# GNATCOLL_MMAP : whether MMAP is supported (yes/no)
47-
# default is "yes"; has no effect on Windows
48-
# GNATCOLL_MADVISE : whether MADVISE is supported (yes/no)
49-
# default is "yes"; has no effect on Windows
46+
# GNATCOLL_MMAP : whether MMAP is supported (yes/no)
47+
# default is "yes"; has no effect on Windows
48+
# GNATCOLL_MADVISE : whether MADVISE is supported (yes/no)
49+
# default is "yes"; has no effect on Windows
50+
# GNATCOLL_PROJECTS : whether GNATCOLL projects package is included (yes/no)
51+
# default is "yes";
5052

5153
# helper programs
5254
CAT := cat
5355
ECHO := echo
5456
WHICH := which
57+
SED := sed
5558

5659
# check for out-of-tree build
5760
SOURCE_DIR := $(dir $(MAKEFILE_LIST))
@@ -83,6 +86,7 @@ prefix := $(dir $(shell $(WHICH) gnatls))..
8386
GNATCOLL_VERSION := $(shell $(CAT) $(SOURCE_DIR)/version_information)
8487
GNATCOLL_MMAP := yes
8588
GNATCOLL_MADVISE := yes
89+
GNATCOLL_PROJECTS := yes
8690

8791
BUILD = PROD
8892
PROCESSORS = 0
@@ -123,6 +127,7 @@ endif
123127

124128
GPR_VARS=-XGNATCOLL_MMAP=$(GNATCOLL_MMAP) \
125129
-XGNATCOLL_MADVISE=$(GNATCOLL_MADVISE) \
130+
-XGNATCOLL_PROJECTS=$(GNATCOLL_PROJECTS) \
126131
-XGNATCOLL_VERSION=$(GNATCOLL_VERSION) \
127132
-XGNATCOLL_OS=$(GNATCOLL_OS) \
128133
-XBUILD=$(BUILD)
@@ -145,6 +150,18 @@ UNINSTALLER=$(INSTALLER) -p -f --install-name=gnatcoll --uninstall
145150
build: $(LIBRARY_TYPES:%=build-%)
146151

147152
build-%: $(GNATCOV_RTS)
153+
154+
# Gnatcoll projects related packages need libgpr. As conditional
155+
# with does not exist in GPR, `with "gpr"` at the beginning of
156+
# gnatcoll.gpr needs to be commented or uncommented depending on
157+
# the user choice.
158+
159+
ifeq ($(GNATCOLL_PROJECTS), yes)
160+
$(SED) -i 's/^-- with "gpr"/with "gpr"/g' $(GNATCOLL_GPR)
161+
else
162+
$(SED) -i 's/^with "gpr"/-- with "gpr"/g' $(GNATCOLL_GPR)
163+
endif
164+
148165
ifeq ($(GNATCOV), yes)
149166
$(GNATCOV_PROJECT_PATH) gnatcov instrument -P $(GNATCOLL_GPR) $(RBD) \
150167
--no-subprojects --level=stmt+decision
@@ -204,6 +221,7 @@ setup:
204221
$(ECHO) "GNATCOLL_VERSION=$(GNATCOLL_VERSION)" >> makefile.setup
205222
$(ECHO) "GNATCOLL_MMAP=$(GNATCOLL_MMAP)" >> makefile.setup
206223
$(ECHO) "GNATCOLL_MADVISE=$(GNATCOLL_MADVISE)" >> makefile.setup
224+
$(ECHO) "GNATCOLL_PROJECTS=$(GNATCOLL_PROJECTS)" >> makefile.setup
207225

208226
# Let gprbuild handle parallelisation. In general, we don't support parallel
209227
# runs in this Makefile, as concurrent gprinstall processes may crash.

gnatcoll.gpr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ project GnatColl is
2929
Name := "gnatcoll";
3030

3131
type Yes_No is ("yes", "no");
32-
Mmap : Yes_No := External ("GNATCOLL_MMAP", "yes");
33-
Madvise : Yes_No := External ("GNATCOLL_MADVISE", "yes");
32+
Mmap : Yes_No := External ("GNATCOLL_MMAP", "yes");
33+
Madvise : Yes_No := External ("GNATCOLL_MADVISE", "yes");
34+
Projects : Yes_No := External ("GNATCOLL_PROJECTS", "yes");
3435

3536
type Build_Type is ("DEBUG", "PROD");
3637
Build : Build_Type :=
@@ -51,6 +52,13 @@ project GnatColl is
5152
Sources := Sources & ("src/os/win32");
5253
end case;
5354

55+
case Projects is
56+
when "yes" =>
57+
Sources := Sources & ("src/projects");
58+
when others =>
59+
null;
60+
end case;
61+
5462
for Source_Dirs use Sources;
5563

5664
for Library_Kind use Library_Type;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)