Skip to content

Commit

Permalink
Merge branch 'cleanup-spec' into 'master'
Browse files Browse the repository at this point in the history
Cleanup the build files, build common subpackage

There's no need to have two OBS project build separate versions for the single source. This patchset:

* Gets rid of the `precheckin.sh` script and the need for two .spec files
* Removes spectacle cruft from the .spec file
* Builds the dynamic and static version from the same source (`-static` subpackage)
* Makes the .spec easier to maintain by having the architecture list as RPM macro
* Common utilities into separate packages (`-common` subpackage)

See merge request !3
  • Loading branch information
thp committed Jun 2, 2015
2 parents a3d1aaa + 88aecf0 commit 1b99b5c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 254 deletions.
3 changes: 0 additions & 3 deletions precheckin.sh

This file was deleted.

142 changes: 0 additions & 142 deletions qemu-usermode-static.spec

This file was deleted.

126 changes: 59 additions & 67 deletions qemu-usermode.spec
@@ -1,13 +1,7 @@
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.25
#
# Target architectures to build emulators of
%define target_list aarch64 arm mipsel

Name: qemu-usermode

# >> macros
# << macros

Summary: Universal CPU emulator
Version: 2.1.0
Release: 1
Expand All @@ -17,8 +11,6 @@ ExclusiveArch: %{ix86}
URL: https://launchpad.net/qemu-linaro/
Source0: qemu-%{version}.tar.bz2
Source1: qemu-binfmt-conf.sh
Source2: precheckin.sh
Source100: qemu-usermode.yaml
Patch0: fix-glibc-install-locales.patch
Patch1: mips-support.patch
Patch2: 0038-linux-user-fix-segfault-deadlock.pa.patch
Expand All @@ -37,6 +29,7 @@ BuildRequires: glibc-static
BuildRequires: python-devel
BuildRequires: glib2-static
BuildRequires: pcre-static
Requires: %{name}-common = %{version}

%description
QEMU is an extremely well-performing CPU emulator that allows you to choose between simulating an entire system and running userspace binaries for different architectures under your native operating system. It currently emulates x86, ARM, PowerPC and SPARC CPUs as well as PC and PowerMac systems.
Expand All @@ -61,82 +54,81 @@ QEMU is an extremely well-performing CPU emulator that allows you to choose betw
%patch6 -p1
# fix-strex.patch
%patch7 -p1
# >> setup
# << setup

%build
# >> build pre
%if "%{name}" == "qemu-usermode-static"
%define staticflag --static
%else
%define staticflag %{nil}
%endif

CFLAGS=`echo $CFLAGS | sed 's|-fno-omit-frame-pointer||g'` ; export CFLAGS ;
CFLAGS=`echo $CFLAGS | sed 's|-O2|-O|g'` ; export CFLAGS ;


./configure \
--prefix=/usr \
--sysconfdir=%_sysconfdir \
%{staticflag} \
--interp-prefix=/usr/share/qemu/qemu-i386 \
--disable-system \
--enable-linux-user \
--enable-guest-base \
--disable-werror \
--target-list=aarch64-linux-user,arm-linux-user,mipsel-linux-user
# << build pre


make %{?jobs:-j%jobs}

# >> build post
# << build post
CONFIGURE_FLAGS="--prefix=/usr \
--sysconfdir=%_sysconfdir \
--interp-prefix=/usr/share/qemu/qemu-i386 \
--disable-system \
--enable-linux-user \
--enable-guest-base \
--disable-werror \
--target-list=$((for target in %{target_list}; do echo -n ${target}-linux-user,; done) | sed -e 's/,$//')"

for mode in static dynamic; do
mkdir build-$mode
cd build-$mode
if [ $mode = static ]; then
../configure --static $CONFIGURE_FLAGS
else
../configure $CONFIGURE_FLAGS
fi
make %{?jobs:-j%jobs}
cd ..
done

%install
rm -rf %{buildroot}
# >> install pre
%if "%{name}" == "qemu-usermode-static"
mkdir -p %{buildroot}/usr/sbin
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/usr/sbin
%endif
# << install pre
%make_install

# >> install post
for mode in static dynamic; do
cd build-$mode
%make_install
for target in %{target_list}; do
mv %{buildroot}%{_bindir}/qemu-${target} %{buildroot}%{_bindir}/qemu-${target}-${mode}
done
cd ..
done

rm -f $RPM_BUILD_ROOT/usr/share/qemu/openbios-ppc
rm -f $RPM_BUILD_ROOT/usr/share/qemu/openbios-sparc32
rm -f $RPM_BUILD_ROOT/usr/share/qemu/openbios-sparc64
rm -f $RPM_BUILD_ROOT/usr/libexec/qemu-bridge-helper
rm -rf $RPM_BUILD_ROOT/etc
rm -rf $RPM_BUILD_ROOT/%{_datadir}

%if "%{name}" == "qemu-usermode-static"
mv %{buildroot}%{_bindir}/qemu-arm %{buildroot}%{_bindir}/qemu-arm-static
mv %{buildroot}%{_bindir}/qemu-aarch64 %{buildroot}%{_bindir}/qemu-aarch64-static
mv %{buildroot}%{_bindir}/qemu-mipsel %{buildroot}%{_bindir}/qemu-mipsel-static
# Remove these so we don't end up with binaries with the same name in two
# packages.
rm -f %{buildroot}%{_bindir}/qemu-ga
rm -f %{buildroot}%{_bindir}/qemu-img
rm -f %{buildroot}%{_bindir}/qemu-io
rm -f %{buildroot}%{_bindir}/qemu-nbd
%endif

%if "%{name}" == "qemu-usermode"
mv %{buildroot}%{_bindir}/qemu-arm %{buildroot}%{_bindir}/qemu-arm-dynamic
mv %{buildroot}%{_bindir}/qemu-aarch64 %{buildroot}%{_bindir}/qemu-aarch64-dynamic
mv %{buildroot}%{_bindir}/qemu-mipsel %{buildroot}%{_bindir}/qemu-mipsel-dynamic
%endif
# << install post


%files
%defattr(-,root,root,-)
%{_bindir}/qem*
# >> files
%if "%{name}" == "qemu-usermode-static"
%{_bindir}/qemu-*-dynamic
%{_sbindir}/qemu-binfmt-conf.sh
%endif
# << files

%package common
Summary: Universal CPU emulator (common utilities)
Group: System/Emulators/PC

%description common
This package provides common qemu utilities.

%files common
%defattr(-,root,root,-)
%{_bindir}/qemu-ga
%{_bindir}/qemu-img
%{_bindir}/qemu-io
%{_bindir}/qemu-nbd

%package static
Summary: Universal CPU emulator (static userspace emulators)
Group: System/Emulators/PC
Requires: %{name}-common = %{version}

%description static
This package provides static builds of userspace CPU emulators.

%files static
%defattr(-,root,root,-)
%{_bindir}/qemu-*-static
42 changes: 0 additions & 42 deletions qemu-usermode.yaml

This file was deleted.

0 comments on commit 1b99b5c

Please sign in to comment.