[PATCH] print/texinfo: Add texinfo package

chrisj at rtems.org chrisj at rtems.org
Wed Apr 12 02:09:14 UTC 2023


From: Chris Johns <chrisj at rtems.org>

- MacOS systems do not come with makeinfo

- Fix the internal build logic. There was config logic in a
  bset file that does not support logic operators. Use a
  special tmp internal path to isolate the internal tools.
---
 bare/config/print/texinfo-7.0.3.cfg         |  12 +++
 bare/config/print/texinfo-internal.bset     |  11 ++
 bare/config/print/texinfo.bset              |   4 +
 bare/config/print/texinfo.cfg               |   8 ++
 bare/config/textproc/gsed-internal.bset     |   4 -
 rtems/config/tools/rtems-default-tools.bset |  13 ++-
 source-builder/config/gsed-1.cfg            |   6 +-
 source-builder/config/texinfo-1.cfg         | 107 ++++++++++++++++++++
 source-builder/defaults.mc                  |   5 +-
 9 files changed, 158 insertions(+), 12 deletions(-)
 create mode 100644 bare/config/print/texinfo-7.0.3.cfg
 create mode 100644 bare/config/print/texinfo-internal.bset
 create mode 100644 bare/config/print/texinfo.bset
 create mode 100644 bare/config/print/texinfo.cfg
 create mode 100644 source-builder/config/texinfo-1.cfg

diff --git a/bare/config/print/texinfo-7.0.3.cfg b/bare/config/print/texinfo-7.0.3.cfg
new file mode 100644
index 0000000..f8e67be
--- /dev/null
+++ b/bare/config/print/texinfo-7.0.3.cfg
@@ -0,0 +1,12 @@
+#
+# GNU texinfo 7.0.3
+#
+
+%include %{_configdir}/base.cfg
+
+%define texinfo_version 7.0.3
+
+%hash sha512 texinfo-%{texinfo_version}.tar.gz \
+        uJXP+WVCInQgPxcWNogeOx5VfrmruXIwd6OnnpTgrcXW12Icuqe+R9PF1l/8k/uybwfb+0MMdFoYbq7iiIQGSA==
+
+%include %{_configdir}/texinfo-1.cfg
diff --git a/bare/config/print/texinfo-internal.bset b/bare/config/print/texinfo-internal.bset
new file mode 100644
index 0000000..8fa5544
--- /dev/null
+++ b/bare/config/print/texinfo-internal.bset
@@ -0,0 +1,11 @@
+#
+# Internal GNU texinfo
+#
+
+%define _internal_texinfo   yes
+%define _disable_collecting yes
+%define _disable_packaging  yes
+%define _disable_reporting  yes
+%define _disable_installing yes
+
+%include print/texinfo.bset
diff --git a/bare/config/print/texinfo.bset b/bare/config/print/texinfo.bset
new file mode 100644
index 0000000..347c48d
--- /dev/null
+++ b/bare/config/print/texinfo.bset
@@ -0,0 +1,4 @@
+#
+# GNU texinfo
+#
+print/texinfo.cfg
diff --git a/bare/config/print/texinfo.cfg b/bare/config/print/texinfo.cfg
new file mode 100644
index 0000000..5fa0cba
--- /dev/null
+++ b/bare/config/print/texinfo.cfg
@@ -0,0 +1,8 @@
+#
+# GNU makeinfo has a version option, check for it.
+# If not found build it.
+#
+%define has_makeinfo %(makeinfo --version > /dev/null 2>&1; echo $?)
+%if %{has_makeinfo} != 0
+ %include %{_configdir}/print/texinfo-7.0.3.cfg
+%endif
diff --git a/bare/config/textproc/gsed-internal.bset b/bare/config/textproc/gsed-internal.bset
index c45e498..7b2c3b8 100644
--- a/bare/config/textproc/gsed-internal.bset
+++ b/bare/config/textproc/gsed-internal.bset
@@ -2,10 +2,6 @@
 # Internal GNU sed
 #
 
-%if !{defined _internal_gsed_path}
- %error no gsed internal install path defined
-%endif
-
 %define _internal_gsed      yes
 %define _disable_collecting yes
 %define _disable_packaging  yes
diff --git a/rtems/config/tools/rtems-default-tools.bset b/rtems/config/tools/rtems-default-tools.bset
index b81f1e8..0291786 100644
--- a/rtems/config/tools/rtems-default-tools.bset
+++ b/rtems/config/tools/rtems-default-tools.bset
@@ -5,16 +5,23 @@
 # GCC requires a GNU sed so build an internal version if one is not
 # available
 #
-%define _internal_gsed_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
-textproc/gsed-internal
+%define _internal_gsed_path %{_tmpinternal}
+%defineifnot with_rtems_gmp textproc/gsed-internal
+
+# GNU tools need texinfo for makeinfo to build documentation
+%define _internal_texinfo_path %{_tmpinternal}
+%defineifnot with_rtems_texinfo print/texinfo-internal
 
 #
 # Build gdb first to raise the Python install error as early as
-# possible. GDB needs expat so it needs to be built before gdb.
+# possible.
+#
+# GCC and GDB need GMP.
 #
 %{with_rtems_dtc}
 %{with_rtems_expat}
 %{with_rtems_gmp}
+%{with_rtems_texinfo}
 %{with_rtems_gdb}
 %{with_rtems_binutils}
 %{with_rtems_gcc}
diff --git a/source-builder/config/gsed-1.cfg b/source-builder/config/gsed-1.cfg
index 87eb0fb..9135414 100644
--- a/source-builder/config/gsed-1.cfg
+++ b/source-builder/config/gsed-1.cfg
@@ -11,9 +11,6 @@
 %ifn %{defined _internal_gsed}
   %define _internal_gsed no
 %endif
-%ifn %{defined _internal_gsed_path}
-  %define _internal_gsed_path %{_prefix}
-%endif
 
 Name:      gsed-%{gsed_version}-%{_host}-%{release}
 Summary:   GNU sed v%{gsed_version} for host %{_host}
@@ -30,6 +27,9 @@ URL: 	   https://www.gnu.org/software/sed/
 # Remap the install paths if it is an internal build
 #
 %if %{_internal_gsed} == yes
+  %if !%{defined _internal_gsed_path}
+    %error no gsed internal install path defined
+  %endif
   %define gsed_prefix %{_internal_gsed_path}
 %else
   %define gsed_prefix %{_prefix}
diff --git a/source-builder/config/texinfo-1.cfg b/source-builder/config/texinfo-1.cfg
new file mode 100644
index 0000000..d1fc2a0
--- /dev/null
+++ b/source-builder/config/texinfo-1.cfg
@@ -0,0 +1,107 @@
+#
+# GNU texinfo 7.xx Version 1.
+#
+# This configuration file configure's, make's and install's GNU's texinfo
+#
+
+%if %{release} == %{nil}
+ %define release 1
+%endif
+
+%ifn %{defined _internal_texinfo}
+  %define _internal_texinfo no
+%endif
+
+Name:      texinfo-%{texinfo_version}-%{_host}-%{release}
+Summary:   GNU texinfo v%{texinfo_version} for host %{_host}
+Version:   %{texinfo_version}
+Release:   %{release}
+URL: 	   https://www.gnu.org/software/texinfo/
+
+#
+# Source
+#
+%source set texinfo https://ftp.gnu.org/gnu/texinfo/texinfo-%{texinfo_version}.tar.gz
+
+#
+# Remap the install paths if it is an internal build
+#
+%if %{_internal_texinfo} == yes
+  %if !%{defined _internal_texinfo_path}
+    %error no texinfo internal install path defined
+  %endif
+  %define texinfo_prefix %{_internal_texinfo_path}
+%else
+  %define texinfo_prefix %{_prefix}
+%endif
+
+%define texinfo_exec_prefix    %{texinfo_prefix}
+%define texinfo_bindir         %{texinfo_exec_prefix}/bin
+%define texinfo_sbindir        %{texinfo_exec_prefix}/sbin
+%define texinfo_libexecdir     %{texinfo_exec_prefix}/libexec
+%define texinfo_datarootdir    %{texinfo_prefix}/share
+%define texinfo_datadir        %{texinfo_datarootdir}
+%define texinfo_sysconfdir     %{texinfo_prefix}/etc
+%define texinfo_sharedstatedir %{texinfo_prefix}/com
+%define texinfo_localstatedir  %{texinfo_prefix}/var
+%define texinfo_includedir     %{texinfo_prefix}/include
+%define texinfo_libdir         %{texinfo_exec_prefix}/%{_lib}
+%define texinfo_mandir         %{texinfo_datarootdir}/man
+%define texinfo_infodir        %{texinfo_datarootdir}/info
+%define texinfo_localedir      %{texinfo_datarootdir}/locale
+
+#
+# Prepare the source code.
+#
+%prep
+  build_top=$(pwd)
+
+  source_dir_texinfo="texinfo-%{texinfo_version}"
+  %source setup texinfo -q -n texinfo-%{texinfo_version}
+  %patch setup texinfo -p1
+
+  cd ${build_top}
+
+%build
+  build_top=$(pwd)
+
+  %if %{defined _internal_texinfo_path}
+    export PATH="%{_internal_texinfo_path}/bin:${PATH}"
+  %endif
+
+  %{build_directory}
+
+  mkdir -p ${build_dir}
+  cd ${build_dir}
+
+  %{host_build_flags}
+
+  ../${source_dir_texinfo}/configure \
+    --prefix=%{texinfo_prefix} \
+    --bindir=%{texinfo_bindir} \
+    --exec_prefix=%{texinfo_exec_prefix} \
+    --includedir=%{texinfo_includedir} \
+    --libdir=%{texinfo_libdir} \
+    --libexecdir=%{texinfo_libexecdir} \
+    --mandir=%{texinfo_mandir} \
+    --infodir=%{texinfo_infodir} \
+    --datadir=%{texinfo_datadir} \
+
+  %{__make} %{?_smp_mflags} all
+
+  cd ${build_top}
+
+%install
+  build_top=$(pwd)
+
+  %{__rmdir} $SB_BUILD_ROOT
+
+  cd ${build_dir}
+
+  %if %{_internal_texinfo} == yes
+    %{__make} install
+  %else
+    %{__make} DESTDIR=$SB_BUILD_ROOT install
+  %endif
+
+  cd ${build_top}
diff --git a/source-builder/defaults.mc b/source-builder/defaults.mc
index 503dd92..6575e35 100644
--- a/source-builder/defaults.mc
+++ b/source-builder/defaults.mc
@@ -109,6 +109,7 @@ _docdir:             dir,     none,     '%{_defaultdocdir}'
 _tmppath:            dir,     none,     '%{_topdir}/build/tmp'
 _tmproot:            dir,     none,     '%{_tmppath}/sb-%{_uid}/%{_bset_tmp}'
 _tmpcxcroot:         dir,     none,     '%{_tmppath}/sb-%{_uid}-cxc/%{_bset_tmp}'
+_tmpinternal:        dir,     none,     '%{_tmppath}/sb-%{_uid}-internal'
 _datadir:            dir,     none,     '%{_prefix}/share'
 _defaultdocdir:      dir,     none,     '%{_prefix}/share/doc'
 _dry_run:            none,    none,     '0'
@@ -131,7 +132,7 @@ _infodir:            dir,     none,     '%{_datarootdir}/info'
 _localedir:          dir,     none,     '%{_datarootdir}/locale'
 _localedir:          dir,     none,     '%{_datadir}/locale'
 _localstatedir:      dir,     none,     '%{_prefix}/var'
-_pathprepend:        none,    none,     ''
+_pathprepend:        none,    none,     '%{_tmpinternal}/bin'
 _pathpostpend:       none,    none,     ''
 _prefix:             dir,     none,     '%{_usr}'
 _usr:                dir,     none,     '/usr/local'
@@ -179,7 +180,7 @@ __ld:                exe,     required, '/usr/bin/ld'
 __ldconfig:          exe,     required, '/sbin/ldconfig'
 __ln_s:              exe,     none,     'ln -s'
 __make:              exe,     required, 'make'
-__makeinfo:          exe,     required, '/usr/bin/makeinfo'
+__makeinfo:          exe,     optional, '/usr/bin/makeinfo'
 __mkdir:             exe,     required, '/bin/mkdir'
 __mkdir_p:           exe,     none,     '/bin/mkdir -p'
 __mv:                exe,     required, '/bin/mv'
-- 
2.37.1



More information about the devel mailing list