File squeak-vm.spec of Package squeak-vm

Name: squeak-vm
Version: 4.10.2
%define        real_version 4.10.2.2614-src
Release: 2
Summary: The Squeak virtual machine
License: MIT
Group: Development/Languages/Other
Url: http://squeakvm.org/unix
Source0: Squeak-%{real_version}.tar.gz
Source1: squeak.desktop
Source2: squeak.png
Source3: squeak.xml
Patch0:  squeak_share_dir.patch
Patch1:  squeak_sh_man.patch
Patch2:  squeak-vm-4.10.2-gcc-14-fix.patch
Patch3:  cmake_CMP0054.patch
Patch4:  fix_function_returning_non-void.patch

BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: freetype2-devel  
%if 0%{?mandriva_version}
BuildRequires: libalsa-devel
BuildRequires: libdbus-1-devel
%ifarch x86_64
BuildRequires: lib64xorg-x11-devel  
%else
BuildRequires: libxorg-x11-devel  
%endif
%else
BuildRequires: alsa-devel
BuildRequires: dbus-1-devel  
BuildRequires: gstreamer-devel >= 0.10
BuildRequires: xorg-x11-Mesa-devel  
%endif
BuildRequires: libogg-devel  
BuildRequires: pango-devel  
BuildRequires: cairo-devel  
BuildRequires: pkgconfig  
BuildRequires: libuuid-devel  
%if 0%{?suse_version}
BuildRequires: fdupes
BuildRequires: libpulse-devel
BuildRequires: update-desktop-files
%endif

BuildRoot: %{_tmppath}/%{name}-%{version}-build

%description
Squeak is a full-featured implementation of the Smalltalk programming
language and environment based on (and largely compatible with) the original
Smalltalk-80 system.  Squeak has very powerful 2- and 3-D graphics, sound,
video, MIDI, animation and other multimedia capabilities -- and one of the
most impressive development environments ever created.  It also includes a
customisable framework for creating dynamic HTTP servers and interactively
extensible Web sites.  The entire Squeak system is open source software,
distributed freely with a liberal license.  See <http://Squeak.org>; for
further information.

%prep
%setup -q -n Squeak-%{real_version}
%patch -P 0 -p0
%patch -P 1 -p0
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1

%build
#cmake policy CMP0014 requires CMakeLists.txt in subdirectories
touch unix/npsqueak/CMakeLists.txt
#the compilation of the file any-libffi-asm.S (x86_64) and x86-sysv-asm.S (i586) creates 
#the binary so.SqueakFFIPrims that declares the stack as executable causing rpmlint to 
#generate a 10000 badness, add GNU_STACK markings to such sources to avoid the issue
echo -e '#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' >>unix/plugins/SqueakFFIPrims/any-libffi-asm.S
echo -e '#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' >>unix/plugins/SqueakFFIPrims/x86-sysv-asm.S
mkdir bld
cd bld
../unix/cmake/configure --prefix=%{_prefix} -DCMAKE_POLICY_VERSION_MINIMUM=3.5 --CFLAGS="-std=gnu11 -Wno-error=implicit-function-declaration"
make

%install
make DESTDIR=%{?buildroot:%{buildroot}} install
install -Dm644 %{SOURCE1} %{buildroot}%{_datadir}/applications/squeak.desktop
install -Dm644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/squeak.png
%if 0%{?suse_version}
%if 0%{?suse_version} > 1200
install -Dm644 %{SOURCE3} %{buildroot}%{_datadir}/mime/application/squeak.xml
%endif
%suse_update_desktop_file squeak Development IDE
%fdupes -s %{buildroot}
%ifarch x86_64
mkdir -p %{buildroot}%{_libdir}
mv %{buildroot}/usr/lib/squeak %{buildroot}%{_libdir}/squeak
%endif
%endif

# Correct prefix
for i in squeak squeak.sh; do
sed -i -e "s@^prefix=.*@prefix=\"/usr\"@"  %{buildroot}%{_bindir}/$i
done
sed -i -e "/^libdir=/c libdir=\"\$\{prefix\}/lib64/squeak\"" %{buildroot}%{_bindir}/squeak

%files 
%defattr(-,root,root,-)
%{_bindir}/*
%{_libdir}/squeak
%{_mandir}/man1/*
%{_datadir}/applications/squeak.desktop
%{_datadir}/pixmaps/squeak.png
%if 0%{?suse_version} > 1200
%dir %{_datadir}/mime/application
%{_datadir}/mime/application/squeak.xml
%endif

%doc unix/doc unix/README unix/ChangeLog

%changelog
openSUSE Build Service is sponsored by