[PATCH 2/3] textproc/gsed: Add GNU sed build support
chrisj at rtems.org
chrisj at rtems.org
Wed Sep 14 07:02:37 UTC 2022
From: Chris Johns <chrisj at rtems.org>
Updates #2300
---
bare/config/textproc/gsed-4.8.cfg | 12 +++
bare/config/textproc/gsed-internal.bset | 12 +++
bare/config/textproc/gsed.bset | 4 +
bare/config/textproc/gsed.cfg | 8 ++
source-builder/config/gsed-1.cfg | 108 ++++++++++++++++++++++++
5 files changed, 144 insertions(+)
create mode 100644 bare/config/textproc/gsed-4.8.cfg
create mode 100644 bare/config/textproc/gsed-internal.bset
create mode 100644 bare/config/textproc/gsed.bset
create mode 100644 bare/config/textproc/gsed.cfg
create mode 100644 source-builder/config/gsed-1.cfg
diff --git a/bare/config/textproc/gsed-4.8.cfg b/bare/config/textproc/gsed-4.8.cfg
new file mode 100644
index 0000000..8806bef
--- /dev/null
+++ b/bare/config/textproc/gsed-4.8.cfg
@@ -0,0 +1,12 @@
+#
+# GNU sed 4.8
+#
+
+%include %{_configdir}/base.cfg
+
+%define gsed_version 4.8
+
+%hash sha512 sed-%{gsed_version}.tar.gz \
+ C94KIhaOMQCwIUKTsTu6CEzM5F/7WGtsV1OPUY52akRDn/vyR4mPK7j1BtBTHTbynAp7cIhJVbqTz8/YhjG/eQ==
+
+%include %{_configdir}/gsed-1.cfg
diff --git a/bare/config/textproc/gsed-internal.bset b/bare/config/textproc/gsed-internal.bset
new file mode 100644
index 0000000..e93e1a5
--- /dev/null
+++ b/bare/config/textproc/gsed-internal.bset
@@ -0,0 +1,12 @@
+#
+# Internal GNU sed
+#
+
+%define _internal_gsed yes
+%define _internal_gsed_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
+%define _disable_collecting yes
+%define _disable_packaging yes
+%define _disable_reporting yes
+%define _disable_installing yes
+
+%include textproc/gsed.bset
diff --git a/bare/config/textproc/gsed.bset b/bare/config/textproc/gsed.bset
new file mode 100644
index 0000000..68f2e13
--- /dev/null
+++ b/bare/config/textproc/gsed.bset
@@ -0,0 +1,4 @@
+#
+# GNU sed
+#
+textproc/gsed.cfg
diff --git a/bare/config/textproc/gsed.cfg b/bare/config/textproc/gsed.cfg
new file mode 100644
index 0000000..8287c74
--- /dev/null
+++ b/bare/config/textproc/gsed.cfg
@@ -0,0 +1,8 @@
+#
+# GNU sed has a version option, check for it.
+# If not found build it.
+#
+%define has_gnu_sed %(sed --version > /dev/null 2>&1; echo $?)
+%if %{has_gnu_sed} != 0
+ %include %{_configdir}/textproc/gsed-4.8.cfg
+%endif
diff --git a/source-builder/config/gsed-1.cfg b/source-builder/config/gsed-1.cfg
new file mode 100644
index 0000000..828da50
--- /dev/null
+++ b/source-builder/config/gsed-1.cfg
@@ -0,0 +1,108 @@
+#
+# GNU sed 1.xx Version 1.
+#
+# This configuration file configure's, make's and install's GNU's sed
+#
+
+%if %{release} == %{nil}
+ %define release 1
+%endif
+
+%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}
+Version: %{gsed_version}
+Release: %{release}
+URL: https://www.gnu.org/software/sed/
+
+#
+# Source
+#
+%source set gsed https://ftp.gnu.org/gnu/sed/sed-%{gsed_version}.tar.gz
+
+#
+# Remap the install paths if it is an internal build
+#
+%if %{_internal_gsed} == yes
+ %define gsed_prefix %{_internal_gsed_path}
+%else
+ %define gsed_prefix %{_prefix}
+%endif
+
+%define gsed_exec_prefix %{gsed_prefix}
+%define gsed_bindir %{gsed_exec_prefix}/bin
+%define gsed_sbindir %{gsed_exec_prefix}/sbin
+%define gsed_libexecdir %{gsed_exec_prefix}/libexec
+%define gsed_datarootdir %{gsed_prefix}/share
+%define gsed_datadir %{gsed_datarootdir}
+%define gsed_sysconfdir %{gsed_prefix}/etc
+%define gsed_sharedstatedir %{gsed_prefix}/com
+%define gsed_localstatedir %{gsed_prefix}/var
+%define gsed_includedir %{gsed_prefix}/include
+%define gsed_libdir %{gsed_exec_prefix}/%{_lib}
+%define gsed_mandir %{gsed_datarootdir}/man
+%define gsed_infodir %{gsed_datarootdir}/info
+%define gsed_localedir %{gsed_datarootdir}/locale
+
+#
+# Prepare the source code.
+#
+%prep
+ build_top=$(pwd)
+
+ source_dir_gsed="sed-%{gsed_version}"
+ %source setup gsed -q -n sed-%{gsed_version}
+ %patch setup gsed -p1
+
+ cd ${build_top}
+
+%build
+ build_top=$(pwd)
+
+ %if %{defined _internal_gsed_path}
+ export PATH="%{_internal_gsed_path}/bin:${PATH}"
+ %endif
+
+ %{build_directory}
+
+ mkdir -p ${build_dir}
+ cd ${build_dir}
+
+ %{host_build_flags}
+
+ ../${source_dir_gsed}/configure \
+ --prefix=%{gsed_prefix} \
+ --bindir=%{gsed_bindir} \
+ --exec_prefix=%{gsed_exec_prefix} \
+ --includedir=%{gsed_includedir} \
+ --libdir=%{gsed_libdir} \
+ --libexecdir=%{gsed_libexecdir} \
+ --mandir=%{gsed_mandir} \
+ --infodir=%{gsed_infodir} \
+ --datadir=%{gsed_datadir} \
+ --build=%{_build} --host=%{_host}
+
+ %{__make} %{?_smp_mflags} all
+
+ cd ${build_top}
+
+%install
+ build_top=$(pwd)
+
+ %{__rmdir} $SB_BUILD_ROOT
+
+ cd ${build_dir}
+
+ %if %{_internal_gsed} == yes
+ %{__make} install
+ %else
+ %{__make} DESTDIR=$SB_BUILD_ROOT install
+ %endif
+
+ cd ${build_top}
--
2.37.1
More information about the devel
mailing list