Blob Blame History Raw
# Conditional for release and snapshot builds.
# Uncomment for release-builds.
%global			rel_build	1

# Conditional for bootstrapping new distributions.
# Uncomment for bootstrap-builds.
#global			bootstrap_build	1

# Settings used for build from snapshots.
%{!?rel_build:%global	commit		a85b2c6a5bf53de97883299a87f61a0bcf6844b7}
%{!?rel_build:%global	commit_date	20141215}
%{!?rel_build:%global	shortcommit	%(c=%{commit};echo ${c:0:7})}
%{!?rel_build:%global	gitver		git%{commit_date}-%{shortcommit}}
%{!?rel_build:%global	gitrel		.git%{commit_date}.%{shortcommit}}

# Proper naming for the tarball from github.
%global			gittar		%{name}-%{version}%{!?rel_build:-%{gitver}}.tar.gz

# Place rpm-macros into proper location.
%{!?_macrosdir:%global	_macrosdir	%(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)}

# Setup _pkgdocdir if not defined already.
%{!?_pkgdocdir:%global	_pkgdocdir	%{_docdir}/%{name}-%{version}}

# Are licenses packaged using %%license?
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8
%bcond_without		license_dir
%else  # 0%%{?fedora} >= 21 || 0%%{?rhel} >= 8
%bcond_with		license_dir
%endif # 0%%{?fedora} >= 21 || 0%%{?rhel} >= 8

# This is a package from a whole suite.
%global			suite_name	yast
%global			name_suffix	devtools
%global			repo_name	%{suite_name}-%{name_suffix}
%global			src_url		https://github.com/%{suite_name}/%{repo_name}

Name:		%{suite_name}2-%{name_suffix}
Version:	3.1.31
Release:	2%{?gitrel}%{?dist}
Summary:	YaST Development Tools

License:	GPLv2+
URL:		https://en.opensuse.org/Portal:YaST
# Sources for release-builds.
%{?rel_build:Source0:	%{src_url}/archive/%{repo_name}/master/%{version}.tar.gz#/%{gittar}}
# Sources for snapshot-builds.
%{!?rel_build:Source0:	%{src_url}/archive/%{commit}.tar.gz#/%{gittar}}

# Patches cherry-picked from PR to upstream.  See:
# https://github.com/yast/yast-devtools/pull/85
Patch0:		https://github.com/besser82/yast-devtools/commit/55faf823b8802c7c3db05d1e3d13a4e1ae8ecc0f.patch#/yast2-devtools-3.1.31_use_new_AC_INIT_syntax.patch
Patch1:		https://github.com/besser82/yast-devtools/commit/015df9c12f30caccaa46286c06e11999d7216ab8.patch#/yast2-devtools-3.1.31_replace_obsolete_AC_PROG_LIBTOOL.patch
BuildArch:	noarch

BuildRequires:	automake
BuildRequires:	docbook-style-xsl
BuildRequires:	doxygen
BuildRequires:	fdupes
BuildRequires:	gettext
BuildRequires:	libtool
BuildRequires:	libxslt
BuildRequires:	pkgconfig
BuildRequires:	rubygem(redcarpet)
BuildRequires:	rubygem(yard)

Requires:	%{_bindir}/libtool
Requires:	%{_bindir}/xsltproc
Requires:	automake
Requires:	cmake
Requires:	docbook-style-xsl
Requires:	doxygen
Requires:	emacs-filesystem
Requires:	filesystem
Requires:	gettext
Requires:	redhat-rpm-config
Requires:	rubygem(redcarpet)
Requires:	rubygem(yard)

# Additional requirements after bootstrap.
%if 0%{?bootstrap_build} == 0
BuildRequires:	pkgconfig(%{name})
Requires:	config(yast2-filesystem)
%endif # 0%%{?bootstrap_build} == 0

%description
Common scripts and templates for developing
and building YaST2 modules and components.


%prep
%setup -qn %{repo_name}-%{?rel_build:%{repo_name}-master-%{version}}%{!?rel_build:%{commit}}

# Apply patches.
%patch0 -p1 -b .AC_INIT_syntax
%patch1 -p1 -b .use_LT_INIT

# Bootstrap autosh*t.
./build-tools/scripts/y2autoconf --bootstrap ./build-tools/
./build-tools/scripts/y2automake --bootstrap ./build-tools/
%{__cat} ./build-tools/aclocal/*.m4 > acinclude.m4
%{_bindir}/autoreconf -fiv

# Fix-up hashbangs.
for _file in $(%{__grep} -Rle '#![ \t]*/usr/bin/env' .)
do
  %{__sed} -e '1s~^#![ \t]*%{_bindir}/env[ \t]\+~#!%{_bindir}/~'	\
	< ${_file} > ${_file}.new &&					\
	/bin/touch -r ${_file} ${_file}.new &&				\
	%{__mv} -f ${_file}.new ${_file}
done


%build
%configure
%make_build


%install
%make_install

# Create additionally needed dirs.
%{__mkdir} -p %{buildroot}%{?_macrosdir} %{buildroot}%{?_pkgdocdir}

# Install ChangeLog.
%{__cp} -a ./package/yast2-devtools.changes				\
		%{buildroot}%{?_pkgdocdir}/ChangeLog

# Install additional tools.
%{__cp} -a ./mass-tools/y2m %{buildroot}%{_bindir}

# Move documentation to %%{?_pkgdocdir}.
%{__mv} -f %{buildroot}%{_docdir}/packages/yast2-devtools/*		\
		%{buildroot}%{?_pkgdocdir}
%{__install} -pm 0644 ./mass-tools/README				\
	%{buildroot}%{?_pkgdocdir}/README.y2m.txt

# Move rpm-macros to proper dir.
%if "0%{?_macrosdir}" != "0%{_sysconfdir}/rpm"
%{__mv} -f %{buildroot}%{_sysconfdir}/rpm/* %{buildroot}%{?_macrosdir}
%endif # "0%%{?_macrosdir}" != "0%%{_sysconfdir}/rpm"

# This script gets sourced by external commands, only.
%{__chmod} -c 0644							\
	%{buildroot}%{_datadir}/YaST2/data/devtools/bin/gettextdomains

# Final clean-up.
%{__rm} -rf %{buildroot}%{_docdir}/packages/yast2-devtools		\
%if %{with license_dir}
		%{buildroot}%{?_pkgdocdir}/COPYING			\
%endif # %%{with license_dir}
;

# Softlink duplicate files.
%fdupes -s %{buildroot}


%check
%{__make} check


%files
%if %{with license_dir}
%license COPYING
%endif # %%{with license_dir}
%doc %{?_pkgdocdir}
%{_bindir}/y2*
%{_datadir}/aclocal/*.m4
%{_datadir}/cmake/Modules/*.cmake
%{_datadir}/emacs/site-lisp/*
%{_datadir}/pkgconfig/%{name}.pc
%{_datadir}/vim
%{_datadir}/YaST2/*
%{?_macrosdir}/macros.%{suite_name}
%{_prefix}/lib/YaST2/*


%changelog
* Sat May 09 2015 Björn Esser <bjoern.esser@gmail.com> - 3.1.31-2
- fix AutoTools: Obsoleted m4s found: AC_PROG_LIBTOOL (#1220036)
- add Patch0: use new `AC_INIT()`-syntax with args in square braces
- add Patch1: replace obsolete `A[CM]_PROG_LIBTOOL` with `LT_INIT()`

* Fri May 08 2015 Björn Esser <bjoern.esser@gmail.com> - 3.1.31-1
- new upstream release

* Fri May 08 2015 Björn Esser <bjoern.esser@gmail.com> - 3.1.30-1
- initial rpm release (#1218749)

* Mon May 04 2015 Björn Esser <bjoern.esser@gmail.com> - 3.1.30-0.1
- bootstrapping