Skip to content

Commit

Permalink
Merge branch 'po/static-pic' into 'master'
Browse files Browse the repository at this point in the history
Add static-pic build variant.

See merge request eng/toolchain/aws!13
  • Loading branch information
TurboGit committed Sep 8, 2023
2 parents 166c303 + 5c31bdf commit d5ca519
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 60 deletions.
78 changes: 38 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ MAKE_OPT = -s
BDIR = $(BROOTDIR)/$(TARGET)/release
endif

LIBAWS_TYPES=static
ifeq (${ENABLE_SHARED},true)
LIBAWS_TYPES=static relocatable static-pic
endif

#############################################################################
# NO NEED TO CHANGE ANYTHING PAST THIS POINT
#############################################################################
Expand Down Expand Up @@ -173,10 +178,6 @@ GPROPTS = -XPRJ_BUILD=$(PRJ_BUILD) -XPRJ_SOCKLIB=$(PRJ_SOCKLIB) \

GPR_STATIC = -XLIBRARY_TYPE=static -XXMLADA_BUILD=static
GPR_SHARED = -XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=relocatable
GPR_OTHER = -XLIBRARY_TYPE=$(OTHER_LIBRARY_TYPE) \
-XXMLADA_BUILD=$(OTHER_LIBRARY_TYPE)
GPR_DEFAULT = -XLIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE) \
-XXMLADA_BUILD=$(DEFAULT_LIBRARY_TYPE)

#######################################################################
# build
Expand All @@ -190,11 +191,11 @@ build-awsres-tool-native:
build-tools-native: gen-templates build-lib-native
$(GPRBUILD) -p $(GPROPTS) $(GPR_STATIC) tools/tools.gpr

build-lib-native:
$(GPRBUILD) -p $(GPROPTS) aws.gpr
ifeq (${ENABLE_SHARED}, true)
$(GPRBUILD) -p $(GPROPTS) $(GPR_SHARED) aws.gpr
endif
build-libs-%:
$(GPRBUILD) -p $(GPROPTS) \
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr

build-lib-native: ${LIBAWS_TYPES:%=build-libs-%}

build-gps-support: build-lib-native
$(GPRBUILD) -p $(GPROPTS) $(GPR_STATIC) gps/gps_support.gpr
Expand All @@ -206,12 +207,11 @@ build-tools-cross: build-lib-cross
$(GPRBUILD) -p --target=$(TARGET) $(GPROPTS) \
$(GPR_STATIC) tools/tools.gpr

build-lib-cross:
$(GPRBUILD) -p --target=$(TARGET) $(GPROPTS) aws.gpr
ifeq (${ENABLE_SHARED}, true)
build-libs-cross-%:
$(GPRBUILD) -p --target=$(TARGET) $(GPROPTS) \
$(GPR_SHARED) aws.gpr
endif
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr

build-lib-cross: ${LIBAWS_TYPES:%=build-libs-cross-%}

build-dynamo:
make -C config build-dynamo
Expand All @@ -234,18 +234,20 @@ gps: setup
#######################################################################
# clean

clean-native:
clean-libs-%:
$(GPRCLEAN) $(GPROPTS) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr

clean-lib-native: ${LIBAWS_TYPES:%=clean-libs-%}

clean-native: clean-libs-native
-$(GPRCLEAN) $(GPROPTS) $(GPR_STATIC) tools/tools.gpr
ifeq (${ENABLE_SHARED}, true)
-$(GPRCLEAN) $(GPROPTS) $(GPR_SHARED) aws.gpr
endif
-$(GPRCLEAN) $(GPROPTS) $(GPR_STATIC) gps/gps_support.gpr

clean-cross:
-$(GPRCLEAN) $(GPROPTS) --target=$(TARGET) $(GPR_STATIC) aws.gpr
ifeq (${ENABLE_SHARED}, true)
-$(GPRCLEAN) $(GPROPTS) --target=$(TARGET) $(GPR_SHARED) aws.gpr
endif
clean-libs-cross-%:
$(GPRCLEAN) --target=$(TARGET) \
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr

clean-cross: ${LIBAWS_TYPES:%=clean-libs-cross-%}

ifeq (${IS_CROSS}, true)
clean: clean-cross
Expand All @@ -268,36 +270,33 @@ endif
GPRINST_OPTS=-p -f --prefix=$(TPREFIX) \
--build-var=LIBRARY_TYPE --build-var=AWS_BUILD

install-lib-native:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) $(GPR_DEFAULT) \
--build-name=$(DEFAULT_LIBRARY_TYPE) aws.gpr
ifeq (${ENABLE_SHARED}, true)
install-libs-%:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) \
$(GPR_OTHER) --build-name=$(OTHER_LIBRARY_TYPE) aws.gpr
endif
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* \
--build-name=$* aws.gpr

install-lib-native: ${LIBAWS_TYPES:%=install-libs-%}

install-tools-native:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) $(GPR_STATIC) --mode=usage \
--build-name=$(DEFAULT_LIBRARY_TYPE) \
--build-name=static \
--install-name=aws tools/tools.gpr

install-native: install-clean install-lib-native install-tools-native
install-native: install-clean install-libs-native install-tools-native

install-lib-cross:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) \
--target=$(TARGET) $(GPR_DEFAULT) aws.gpr
ifeq (${ENABLE_SHARED}, true)
install-libs-cross-%:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) \
--target=$(TARGET) $(GPR_OTHER) \
--build-name=$(OTHER_LIBRARY_TYPE) aws.gpr
endif
--target=$(TARGET) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* \
--build-name=$* aws.gpr

install-lib-cross: ${LIBAWS_TYPES:%=install-libs-cross-%}

install-tools-cross:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) --mode=usage \
--target=$(TARGET) $(GPROPTS) \
--install-name=aws tools/tools.gpr

install-cross: install-clean install-lib-cross install-tools-cross
install-cross: install-clean install-libs-cross install-tools-cross

ifeq (${IS_CROSS}, true)
install: install-cross
Expand Down Expand Up @@ -368,7 +367,6 @@ setup_modules: $(MODULES_SETUP)

gen_setup:
echo "prefix=$(prefix)" > makefile.setup
echo "DEFAULT_LIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE)" >> makefile.setup
echo "ENABLE_SHARED=$(ENABLE_SHARED)" >> makefile.setup
echo "ZLIB=$(ZLIB)" >> makefile.setup
echo "XMLADA=$(XMLADA)" >> makefile.setup
Expand Down
2 changes: 1 addition & 1 deletion aws.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ aggregate library project AWS is
for Library_Dir use Shared'Library_Dir & "/aws";

case Shared.Library_Type is
when "static" =>
when "static" | "static-pic" =>
null;

when "relocatable" =>
Expand Down
2 changes: 1 addition & 1 deletion include/zlib/zlib.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ library project Zlib is
-- Always build the static Z library as needed by some AWS tools

case Shared.Library_Type is
when "static" =>
when "static" | "static-pic" =>
Zlib_Activated := "Yes";

when "relocatable" =>
Expand Down
6 changes: 0 additions & 6 deletions makefile.checks
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ $(error SSL_DYNAMIC variable must be set to true or false)
endif
endif

ifneq ($(DEFAULT_LIBRARY_TYPE), static)
ifneq ($(DEFAULT_LIBRARY_TYPE), relocatable)
$(error DEFAULT_LIBRARY_TYPE variable must be set to static or relocatable)
endif
endif

ifneq ($(LAL), true)
ifneq ($(LAL), false)
$(error LAL variable must be set to true or false)
Expand Down
10 changes: 0 additions & 10 deletions makefile.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ ENABLE_SHARED=$(shell $(GNAT) make -c -q -p \
-XTARGET=$(TARGET) -XPRJ_TARGET=$(PRJ_TARGET) \
-Pconfig/setup/test_shared 2>/dev/null && echo "true")

##############################################################################
# Specify the default library type to setup for the installed AWS project.
#
# DEFAULT_LIBRARY_TYPE = [static|relocatable]
#
DEFAULT_LIBRARY_TYPE = static

##############################################################################
# XMLADA optional, needed if you want to build SOAP's AWS support. Set XMLADA
# to true to activate XML/Ada support, you must also set ADA_PROJECT_PATH
Expand Down Expand Up @@ -204,9 +197,6 @@ endif
endif
endif

OTHER_LIBRARY_TYPE = \
$(if $(filter-out static,$(DEFAULT_LIBRARY_TYPE)),static,relocatable)

ifeq ($(TARGET), $(shell gcc -dumpmachine))
IS_CROSS=false
GCC= gcc
Expand Down
4 changes: 2 additions & 2 deletions shared.gpr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2003-2022, AdaCore --
-- Copyright (C) 2003-2023, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the --
Expand Down Expand Up @@ -51,7 +51,7 @@ abstract project Shared is
-- Static / Relocatable --
--------------------------

type Library_Kind is ("relocatable", "static");
type Library_Kind is ("relocatable", "static", "static-pic");
Library_Type : Library_Kind := external ("LIBRARY_TYPE", "static");

---------------------
Expand Down

0 comments on commit d5ca519

Please sign in to comment.