Install using gprinstall.

For N420-003.
This commit is contained in:
Pascal Obry
2013-12-22 20:47:27 +01:00
parent 6fa6ae2557
commit 985adb021d
4 changed files with 35 additions and 107 deletions

View File

@@ -1,7 +1,7 @@
############################################################################
# Win32Ada #
# #
# Copyright (C) 2008-2012, AdaCore #
# Copyright (C) 2008-2014, AdaCore #
# #
# This library is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@@ -41,6 +41,7 @@ MKDIR = mkdir
CP = cp -p
GPRBUILD = gprbuild
GPRCLEAN = gprclean
GPRINSTALL = gprinstall
RM = rm -f
HOST = $(shell gcc -dumpmachine)
@@ -85,22 +86,18 @@ setup:
echo "PROCESSORS=$(PROCESSORS)" >> makefile.setup
echo "TARGET=$(TARGET)" >> makefile.setup
install:
$(MKDIR) -p $(TPREFIX)/lib/win32ada/static
$(CP) -pr $(BDIR)/static/lib/* $(TPREFIX)/lib/win32ada/static/
ifeq (${ENABLE_SHARED}, true)
$(MKDIR) -p $(TPREFIX)/lib/win32ada/relocatable
$(CP) -pr $(BDIR)/relocatable/lib/* $(TPREFIX)/lib/win32ada/relocatable/
install-clean:
ifneq (,$(wildcard $(TPREFIX)/share/gpr/manifests/win32ada))
-$(GPRINSTALL) $(GPROPTS) --uninstall --prefix=$(TPREFIX) win32ada
endif
install: install-clean
$(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(TPREFIX) \
-XLIBRARY_TYPE=static -P win32ada
ifeq (${ENABLE_SHARED}, true)
$(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(TPREFIX) \
-XLIBRARY_TYPE=relocatable --build-name=relocatable -P win32ada
endif
$(MKDIR) -p $(TPREFIX)/include/win32ada
$(CP) -pr src/*.ad* $(TPREFIX)/include/win32ada/
# Copy the preprocessed files
for file in $(BDIR)/static/obj/*.prep; do \
cp $$file \
$(TPREFIX)/include/win32ada/$$(basename $$file .prep);\
done
$(MKDIR) -p $(TPREFIX)/lib/gnat
$(CP) config/projects/win32ada.gpr $(TPREFIX)/lib/gnat/
build:
$(GPRBUILD) -p $(GPROPTS) -j$(PROCESSORS) \

View File

@@ -1,64 +1,41 @@
@echo off
rem -----------------------------------------------
set I_BIN=%1\bin
set I_INC=%1\include\win32ada
set I_LIB=%1\lib\win32ada
set I_GPR=%1\lib\gnat
set I_EXP=%1\share\examples\win32ada
rem -----------------------------------------------
rem --
rem ----------------------------------------------- SETUP
if .%1==. goto error
if exist %I_INC% rmdir /S /Q %I_INC%
mkdir %I_INC% 2> nul
if exist %I_LIB% rmdir /S /Q %I_LIB%
mkdir %I_LIB% 2> nul
mkdir %I_LIB%\relocatable 2> nul
mkdir %I_LIB%\static 2> nul
mkdir %I_GPR% 2> nul
mkdir %I_BIN% 2> nul
if exist %I_EXP% rmdir /S /Q %I_EXP%
move win32ada %I_EXP% > nul
set S_GPR=%1\share\gpr\win32ada.gpr
if exist %S_GPR% gprinstall --uninstall --prefix=%1 win32ada.gpr
if not .%2==.nobuild goto build
echo Copying Win32Ada to GNAT installation in %1
move src\*.ad? %I_INC% > nul
if exist %I_GPR%\win32ada.gpr del /F %I_GPR%\win32ada.gpr
move config\projects\win32ada.gpr %I_GPR%
rem --
rem ----------------------------------------------- INSTALL SOURCES
gprinstall -Pwin32ada --prefix=%1 -XLIBRARY_TYPE=static -p --sources-only -a
goto exit
rem -----------------------------------------------
rem --
rem ----------------------------------------------- BUILD
:build
echo Building Win32Ada for GNAT installation in %1
path %1\bin;%path%
for /f "tokens=1* delims=" %%a in ('gcc -dumpmachine') do set TARGET=%%a
set BUILD=.build\%TARGET%\release
if %TARGET%==x86_64-pc-mingw32 ( set PREP_TARGET="Win64" ) else ( set PREP_TARGET="Win32" )
rem ---- preprocess the sources that need it
set PREP_FILES=@PREPFILES@
for %%f in (%PREP_FILES%) do move src\%%f src\%%f-prep > nul
for %%f in (%PREP_FILES%) do gnatprep -DTARGET=%PREP_TARGET% src/%%f-prep src/%%f
gprbuild -q -j0 -p -d -Pwin32ada -XLIBRARY_TYPE=static -XPRJ_BUILD=Release -XTARGET=%TARGET% -XPRJ_TARGET=%PREP_TARGET%
if errorlevel 1 goto error
gprbuild -q -j0 -p -d -Pwin32ada -XLIBRARY_TYPE=relocatable -XPRJ_BUILD=Release -XTARGET=%TARGET% -XPRJ_TARGET=%PREP_TARGET%
if errorlevel 1 goto error
rem ---- move sources
del src\*.*-prep > nul
move src\*.ad? %I_INC% > nul
copy %BUILD%\relocatable\lib\libwin32ada.dll %I_BIN% > nul
move %BUILD%\relocatable\lib\* %I_LIB%\relocatable > nul
move %BUILD%\static\lib\* %I_LIB%\static > nul
if exist %I_GPR%\win32ada.gpr del /F %I_GPR%\win32ada.gpr
move config\projects\win32ada.gpr %I_GPR% > nul
rem --
rem ----------------------------------------------- INSTALL
gprinstall -Pwin32ada -p --prefix=%1 -XLIBRARY_TYPE=static -XPRJ_BUILD=Release -XTARGET=%TARGET% -XPRJ_TARGET=%PREP_TARGET%
gprinstall -Pwin32ada -f -p --prefix=%1 -XLIBRARY_TYPE=relocatable --build-name=relocatable -XPRJ_BUILD=Release -XTARGET=%TARGET% -XPRJ_TARGET=%PREP_TARGET%
rmdir /s /q .build
goto exit
rem -----------------------------------------------
rem --
rem ----------------------------------------------- ERROR
:error
del src\*.*-prep > nul
move src\*.ad? %I_INC% > nul
if exist %I_GPR%\win32ada.gpr del /F %I_GPR%\win32ada.gpr
move config\projects\win32ada.gpr %I_GPR% > nul
rmdir /s /q .build
echo Couldn't build Win32Ada
cd c:\
exit /b 1
rem -----------------------------------------------
rem --
rem ----------------------------------------------- EXIT
:exit
cd c:\
exit /b 0

View File

@@ -1,50 +0,0 @@
------------------------------------------------------------------------------
-- Win32Ada --
-- --
-- Copyright (C) 2008-2012, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or (at --
-- your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- along with this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
------------------------------------------------------------------------------
library project Win32Ada is
for Languages use ("ada");
for Source_Dirs use ("../../include/win32ada");
type Library_Kind is ("relocatable", "static");
Library_Type : Library_Kind := external ("LIBRARY_TYPE", "static");
for Library_Dir use "../win32ada";
case Library_Type is
when "static" =>
for Library_Dir use Project'Library_Dir & "/static";
when "relocatable" =>
for Library_Dir use Project'Library_Dir & "/relocatable";
end case;
for Library_Kind use Library_Type;
for Library_Name use "win32ada";
for Externally_Built use "true";
end Win32Ada;

View File

@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- Win32Ada --
-- --
-- Copyright (C) 2008-2013, AdaCore --
-- Copyright (C) 2008-2014, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
@@ -48,4 +48,8 @@ library project Win32Ada is
package Compiler renames Shared.Compiler;
package Ide renames Shared.Ide;
package Install is
for Artifacts ("share/examples") use ("examples/*");
end Install;
end Win32Ada;