Gnat command names of src:gcc-5
Hi, folks,
I am working on Debian (cross-)bootstrap,
and when try to bootstrap gnat, it fails.
To archive this, I wish gnat have the same scheme as gccgo/gcj etc,
aka the command names are
/usr/bin/gnat-5 instead of /usr/bin/gnat
and simliar.
At the same time, /usr/bin/{triple}-gnat-5 link to /usr/bin/gnat-5.
I also have a patch which makes gnatmake/gnatlink looks for other
commands also have a version suffix.
If you have interesting on it, I will try to apply it.
When this finish, I have another plans,
1. rewrite the gnat support patch set in src:gcc-5
In general, use the upstream way instead of current way.
It will make system simpler and cross build possible.
2. add sjlj support back.
Any idea about it?
--
YunQiang Su
diff --git a/debian/control.m4 b/debian/control.m4
index 2dc022d..e4a9426 100644
--- a/debian/control.m4
+++ b/debian/control.m4
@@ -126,11 +126,6 @@ define(`BASEDEP', `gcj`'PV-base (= ${gcj:Version})')
define(`SOFTBASEDEP', `gcj`'PV-base (>= ${gcj:SoftVersion})')
')
-ifelse(index(SRCNAME, `gnat'), 0, `
-define(`BASEDEP', `gnat`'PV-base (= ${gnat:Version})')
-define(`SOFTBASEDEP', `gnat`'PV-base (>= ${gnat:SoftVersion})')
-')
-
ifenabled(`gccbase',`
Package: gcc`'PV-base
@@ -207,22 +202,6 @@ Description: GCC, the GNU Compiler Collection (gcj base package)
')`'dnl
')`'dnl java
-ifenabled(`gnatbase',`
-Package: gnat`'PV-base`'TS
-Architecture: any
-# "all" causes build instabilities for "any" dependencies (see #748388).
-Section: libs
-Priority: PRI(optional)
-Depends: ${misc:Depends}
-Breaks: gcc-4.6 (<< 4.6.1-8~)
-BUILT_USING`'dnl
-Description: GNU Ada compiler (common files)
- GNAT is a compiler for the Ada programming language. It produces optimized
- code on platforms supported by the GNU Compiler Collection (GCC).
- .
- This package contains files common to all GNAT related packages.
-')`'dnl gnatbase
-
ifenabled(`libgcc',`
Package: libgcc1`'LS
Architecture: ifdef(`TARGET',`CROSS_ARCH',`any')
@@ -4794,6 +4773,46 @@ Description: GNU Standard C++ Library v3 (documentation files)
')`'dnl c++
ifenabled(`ada',`
+ifdef(`TARGET', `', `
+ifenabled(`gnatbase',`
+ifelse(index(SRCNAME, `gnat'), 0, `
+define(`BASEDEP', `gnat`'PV-base (= ${gnat:Version})')
+define(`SOFTBASEDEP', `gnat`'PV-base (>= ${gnat:SoftVersion})')
+')
+Package: gnat`'PV-base`'TS
+Architecture: any
+# "all" causes build instabilities for "any" dependencies (see #748388).
+Section: libs
+Priority: PRI(optional)
+Depends: ${misc:Depends}
+Breaks: gcc-4.6 (<< 4.6.1-8~)
+BUILT_USING`'dnl
+Description: GNU Ada compiler (common files)
+ GNAT is a compiler for the Ada programming language. It produces optimized
+ code on platforms supported by the GNU Compiler Collection (GCC).
+ .
+ This package contains files common to all GNAT related packages.
+')`'dnl gnatbase
+')`'dnl native
+
+ifenabled(`gnatxbase',`
+dnl override default base package dependencies to cross version
+dnl This creates a toolchain that doesnt depend on the system -base packages
+define(`BASETARGET', `PV`'TS')
+define(`BASEDEP', `gnat`'BASETARGET-base (= ${gcc:Version})')
+define(`SOFTBASEDEP', `gnat`'BASETARGET-base (>= ${gcc:SoftVersion})')
+
+Package: gnat`'BASETARGET-base
+Architecture: any
+Section: devel
+Priority: PRI(extra)
+Depends: ${misc:Depends}
+BUILT_USING`'dnl
+Description: GCC, the GNU Compiler Collection (gnat base package)
+ This package contains files common to all java related packages
+ built from the GNU Compiler Collection (GCC).
+')`'dnl gnatxbase
+
Package: gnat`'-GNAT_V`'TS
Architecture: any
Priority: ifdef(`TARGET',`extra',`PRI(optional)')
@@ -4801,10 +4820,10 @@ ifdef(`MULTIARCH', `Pre-Depends: multiarch-support
')`'dnl
Depends: BASEDEP, gcc`'PV`'TS (>= ${gcc:SoftVersion}), ${dep:libgnat}, ${dep:libcdev}, ${shlibs:Depends}, ${misc:Depends}
Suggests: gnat`'PV-doc, ada-reference-manual-2012, gnat`'-GNAT_V-sjlj
-Breaks: gnat (<< 4.6.1), dh-ada-library (<< 6.0), gnat-4.6-base (= 4.6.4-2),
- gnat-4.9-base (= 4.9-20140330-1)
-Replaces: gnat (<< 4.6.1), dh-ada-library (<< 6.0), gnat-4.6-base (= 4.6.4-2),
- gnat-4.9-base (= 4.9-20140330-1)
+Breaks: gnat (<< 4.6.1), dh-ada-library (<< 6.0), gnat-4.6-base,
+ gnat-4.9-base
+Replaces: gnat (<< 4.6.1), dh-ada-library (<< 6.0), gnat-4.6-base,
+ gnat-4.9-base
# Takes over symlink from gnat (<< 4.6.1): /usr/bin/gnatgcc.
# Takes over file from dh-ada-library (<< 6.0): debian_packaging.mk.
# g-base 4.6.4-2, 4.9-20140330-1 contain debian_packaging.mk by mistake.
diff --git a/debian/patches/ada-gcc-name.diff b/debian/patches/ada-gcc-name.diff
index 4008241..a121140 100644
--- a/debian/patches/ada-gcc-name.diff
+++ b/debian/patches/ada-gcc-name.diff
@@ -27,15 +27,24 @@ Index: b/src/gcc/ada/make.adb
===================================================================
--- a/src/gcc/ada/make.adb
+++ b/src/gcc/ada/make.adb
-@@ -671,7 +671,7 @@ package body Make is
+@@ -671,14 +671,14 @@
-- Compiler, Binder & Linker Data and Subprograms --
----------------------------------------------------
-
+
- Gcc : String_Access := Program_Name ("gcc", "gnatmake");
+ Gcc : String_Access := Program_Name ("gcc-5", "gnatmake");
Original_Gcc : constant String_Access := Gcc;
-- Original_Gcc is used to check if Gcc has been modified by a switch
-- --GCC=, so that for VM platforms, it is not modified again, as it can
+ -- result in incorrect error messages if the compiler cannot be found.
+
+- Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
+- Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");
++ Gnatbind : String_Access := Program_Name ("gnatbind-5", "gnatmake");
++ Gnatlink : String_Access := Program_Name ("gnatlink-5", "gnatmake");
+ -- Default compiler, binder, linker programs
+
+ Globalizer : constant String := "codepeer_globalizer";
Index: b/src/gcc/ada/gnatchop.adb
===================================================================
--- a/src/gcc/ada/gnatchop.adb
diff --git a/debian/patches/ada-link-lib.diff b/debian/patches/ada-link-lib.diff
index 22336ad..fa94621 100644
--- a/debian/patches/ada-link-lib.diff
+++ b/debian/patches/ada-link-lib.diff
@@ -945,7 +945,7 @@ Index: b/src/gnattools/Makefile.in
# Installation rules.
install:
-+ $(INSTALL) -s gnatmake gnatlink $(TOOLS) $(DESTDIR)$(bindir)
++ for i in gnatmake gnatlink $(TOOLS);do mv $$i $$i-5; $(INSTALL) -s $$i-5 $(DESTDIR)$(bindir);done
install-strip: install
diff --git a/debian/rules.conf b/debian/rules.conf
index 7cd7f31..d674c88 100644
--- a/debian/rules.conf
+++ b/debian/rules.conf
@@ -477,7 +477,7 @@ endif
GO_BUILD_DEP := netbase,
# try to build with itself, or with the last version
-gnat_build_dep := gnat-5 [$(ada_no_archs)] | gnat-4.9 [$(ada_no_archs)]
+gnat_build_dep := gnat (>= 5) [$(ada_no_archs)] | gnat-4.6 [$(ada_no_archs)] | gnat-4.9 [$(ada_no_archs)],
ifneq (,$(filter $(distrelease), wheezy precise trusty))
gnat_build_dep := gnat-5 [$(ada_no_archs)] | gnat [$(ada_no_archs)]
else ifneq (,$(filter $(distrelease), squeeze lucid))
@@ -498,7 +498,7 @@ else ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
# Special source package just for gnat. Fail early if gnat is not present,
# rather than waste CPU cycles and fail later.
# Bootstrap step needs a gnatgcc symbolic link.
- GNAT_BUILD_DEP := gnat (>= 4.1) | gnat-4.9 | gnat-4.6 (>= 4.6.4-2),
+ GNAT_BUILD_DEP := $(gnat_build_dep),
GNAT_BUILD_DEP += $(SOURCE_BUILD_DEP)
JAVA_BUILD_DEP :=
JAVA_BUILD_INDEP :=
@@ -812,11 +812,13 @@ ifeq ($(with_go),yes)
endif
endif
+ifeq ($(with_ada),yes)
languages += ada
addons += libgnat libs source # libgmath libnof lib64gnat ssp
ifeq ($(with_gnatsjlj),yes)
addons += adasjlj
endif
+endif
languages += java
addons += gcj
@@ -905,7 +907,12 @@ endif
endif
ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
languages = ada
- addons = gnatbase libgnat
+ addons = libgnat
+ addons += $(if $(filter yes,$(with_gnatbase)),gnatbase)
+ addons += $(if $(filter yes,$(with_gnatxbase)),gnatxbase)
+ ifeq ($(with_gnatsjlj),yes)
+ addons += adasjlj
+ endif
endif
endif
ifeq ($(with_separate_gdc),yes)
diff --git a/debian/rules.d/binary-ada.mk b/debian/rules.d/binary-ada.mk
index db35be9..441d357 100644
--- a/debian/rules.d/binary-ada.mk
+++ b/debian/rules.d/binary-ada.mk
@@ -36,6 +36,7 @@ p_gnatd = $(p_gnat)-doc
d_gbase = debian/$(p_gbase)
d_gnat = debian/$(p_gnat)
+d_gnatsjlj = debian/$(p_gnsjlj)
d_lgnat = debian/$(p_lgnat)
d_lgnatvsn = debian/$(p_lgnatvsn)
d_lgnatprj = debian/$(p_lgnatprj)
@@ -58,7 +59,7 @@ dirs_gnat = \
files_gnat = \
$(gcc_lexec_dir)/gnat1 \
$(gcc_lib_dir)/{adalib,adainclude} \
- $(foreach i,$(GNAT_TOOLS),$(PF)/bin/$(cmd_prefix)$(i))
+ $(foreach i,$(GNAT_TOOLS),$(PF)/bin/$(cmd_prefix)$(i)$(pkg_ver))
ifeq ($(with_gnatsjlj),yes)
files_gnat += \
@@ -73,14 +74,13 @@ files_lgnat = \
$(PF)/$(libdir)/lib{gnat,gnarl}-$(GNAT_SONAME).so.1
$(binary_stamp)-gnatbase: $(install_stamp)
+ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
dh_testdir
dh_testroot
dh_installdocs -p$(p_gbase) debian/README.gnat debian/README.maintainers
: # $(p_gbase)
-ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
mkdir -p $(d_gbase)/$(docdir)/$(p_xbase)
ln -sf ../$(p_gbase) $(d_gbase)/$(docdir)/$(p_xbase)/Ada
-endif
dh_installchangelogs -p$(p_gbase) src/gcc/ada/ChangeLog
dh_compress -p$(p_gbase)
dh_fixperms -p$(p_gbase)
@@ -88,6 +88,7 @@ endif
dh_installdeb -p$(p_gbase)
dh_md5sums -p$(p_gbase)
dh_builddeb -p$(p_gbase)
+endif
touch $@
@@ -102,7 +103,7 @@ $(binary_stamp)-libgnat: $(install_stamp)
for lib in lib{gnat,gnarl}; do \
vlib=$$lib-$(GNAT_SONAME); \
- mv $(d)/$(gcc_lib_dir)/adalib/$$vlib.so.1 $(d)/$(PF)/$(libdir)/. ; \
+ mv $(d)/$(gcc_lib_dir)/$(rts_subdir)/adalib/$$vlib.so.1 $(d)/$(PF)/$(libdir)/. ; \
rm -f $(d)/$(gcc_lib_dir)/adalib/$$lib.so.1; \
done
dh_movefiles -p$(p_lgnat) $(files_lgnat)
@@ -275,8 +276,8 @@ endif
rm -rf $(d_gnat)
dh_installdirs -p$(p_gnat) $(dirs_gnat)
# Upstream does not install gnathtml.
- cp src/gcc/ada/gnathtml.pl debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml
- chmod 755 debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml
+ cp src/gcc/ada/gnathtml.pl debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml$(pkg_ver)
+ chmod 755 debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml$(pkg_ver)
dh_movefiles -p$(p_gnat) $(files_gnat)
ifeq ($(with_gnatsjlj),yes)
@@ -315,16 +316,36 @@ else
mkdir -p $(d_gnat)/$(docdir)/$(p_gbase)/ada
cp -p src/gcc/ada/ChangeLog $(d_gnat)/$(docdir)/$(p_gbase)/ada/.
endif
+ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
for i in $(GNAT_TOOLS); do \
case "$$i" in \
- gnat) cp -p debian/gnat.1 $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)gnat.1 ;; \
- *) ln -sf gnat.1 $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)$$i.1; \
+ gnat) cp -p debian/gnat.1 $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)gnat$(pkg_ver).1 ;; \
+ *) ln -sf gnat.1 $(d_gnat)/$(PF)/share/man/man1/$(cmd_prefix)$$i$(pkg_ver).1; \
esac; \
done
+endif
+
+ifneq ($(DEB_CROSS),yes)
+ for i in $(GNAT_TOOLS); do \
+ ln -sf $$i$(pkg_ver) \
+ $(d_gnat)/$(PF)/bin/$(DEB_TARGET_GNU_TYPE)-$$i$(pkg_ver); \
+ ln -sf $$i$(pkg_ver) \
+ $(d_gnat)/$(PF)/bin/$(TARGET_ALIAS)-$$i$(pkg_ver); \
+ done
+
+ for i in $(GNAT_TOOLS); do \
+ ln -sf gnat$(pkg_ver).1 \
+ $(d_gnat)/$(PF)/share/man/man1/$(DEB_TARGET_GNU_TYPE)-$$i$(pkg_ver).1; \
+ ln -sf $$i$(pkg_ver).1 \
+ $(d_gnat)/$(PF)/share/man/man1/$(TARGET_ALIAS)-$$i$(pkg_ver).1; \
+ done
+endif
dh_install -p$(p_gnat) debian/ada/debian_packaging.mk usr/share/ada
- dh_link -p$(p_gnat) usr/bin/gcc-$(GNAT_VERSION) usr/bin/gnatgcc
- dh_link -p$(p_gnat) usr/share/man/man1/gnat.1.gz usr/share/man/man1/gnatgcc.1.gz
+ mv $(d_gnat)/usr/share/ada/debian_packaging.mk \
+ $(d_gnat)/usr/share/ada/debian_packaging-$(GNAT_VERSION).mk
+ dh_link -p$(p_gnat) usr/bin/$(cmd_prefix)gcc$(pkg_ver) usr/bin/$(cmd_prefix)gnatgcc$(pkg_ver)
+ dh_link -p$(p_gnat) usr/share/man/man1/$(cmd_prefix)gnat$(pkg_ver).1.gz usr/share/man/man1/$(cmd_prefix)gnatgcc$(pkg_ver).1.gz
debian/dh_rmemptydirs -p$(p_gnat)
@@ -343,7 +364,7 @@ ifeq ($(with_gnatsjlj),yes)
dh_strip -p$(p_gnsjlj)
dh_compress -p$(p_gnsjlj)
dh_fixperms -p$(p_gnsjlj)
- find $(d_gnat)-sjlj -name '*.ali' | xargs chmod 444
+ find $(d_gnatsjlj) -name '*.ali' | xargs chmod 444
$(cross_shlibdeps) dh_shlibdeps -p$(p_gnsjlj)
$(call cross_mangle_substvars,$(p_gnsjlj))
$(cross_gencontrol) dh_gencontrol -p$(p_gnsjlj) \
diff --git a/debian/rules.defs b/debian/rules.defs
index 1016b30..1c62a21 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -585,8 +585,10 @@ ifneq (,$(filter $(distrelease),lucid))
endif
with_ada := $(call envfilt, ada, , , $(with_ada))
-#ifneq ($(single_package),yes)
-# with_separate_gnat := yes
+#ifeq ($(with_ada),yes)
+ #ifneq ($(single_package),yes)
+ # with_separate_gnat := yes
+ #endif
#endif
ifneq ($(with_separate_gnat),yes)
@@ -606,6 +608,11 @@ ifeq ($(with_ada)-$(with_separate_gnat),yes-yes)
with_cdev := no
with_cc1 := no
with_libcc1 := no
+ ifneq ($(DEB_CROSS),yes)
+ with_gnatbase := yes
+ else
+ with_gnatxbase := yes
+ endif
else
debian_extra_langs += ada
with_ada := built from separate source
Reply to: