Use bcond for rpm conditionals

This commit is contained in:
pcpa 2015-03-17 10:31:38 -03:00
parent b821e70a2d
commit b190ff6bcd

View File

@ -1,8 +1,8 @@
# http://trac.wildfiregames.com/wiki/BuildInstructions#Linux
# enable special maintainer debug build ?
%define with_debug 0
%if %{with_debug}
%bcond_with debug
%if %{with debug}
%define config debug
%define dbg _dbg
%else
@ -14,8 +14,8 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=818401#c46
# http://trac.wildfiregames.com/ticket/1682
%global with_system_nvtt 1
%global without_nvtt 0
%bcond_without system_nvtt
%bcond_without nvtt
Name: 0ad
Version: 0.0.18
@ -41,7 +41,7 @@ Group: Amusements/Games
Summary: Cross-Platform RTS Game of Ancient Warfare
Url: http://play0ad.com
%if %{without_nvtt}
%if %{without nvtt}
# wget http://releases.wildfiregames.com/%%{name}-%%{version}-alpha-unix-build.tar.xz
# tar Jxf %%{name}-%%{version}-alpha-unix-build.tar.xz
# rm -fr %%{name}-%%{version}-alpha/libraries/nvtt
@ -82,7 +82,7 @@ BuildRequires: libxml2-devel
BuildRequires: libzip-devel
BuildRequires: miniupnpc-devel
BuildRequires: mozjs31-devel
%if %{with_system_nvtt}
%if %{with system_nvtt}
BuildRequires: nvidia-texture-tools-devel
%endif
BuildRequires: openal-soft-devel
@ -122,13 +122,13 @@ hobbyist game developers, since 2001.
%prep
%setup -q -n %{name}-%{version}-alpha
%patch0 -p0
%if !%{with_debug}
%if %{without debug}
# disable debug build, and "int 0x3" to trap to debugger (x86 only)
%patch1 -p0
%endif
%patch3 -p0
%if %{with_system_nvtt}
%if %{with system_nvtt}
rm -fr libraries/source/nvtt
%endif
@ -145,10 +145,10 @@ build/workspaces/update-workspaces.sh \
--libdir %{_libdir}/%{name} \
--with-system-mozjs31 \
--with-system-miniupnpc \
%if %{with_system_nvtt}
%if %{with system_nvtt}
--with-system-nvtt \
%endif
%if %{without_nvtt}
%if %{without nvtt}
--without-nvtt \
%endif
%{?_smp_mflags}
@ -157,7 +157,7 @@ make %{?_smp_mflags} -C build/workspaces/gcc config=%{config} verbose=1
#-----------------------------------------------------------------------
# Depends on availablity of nvtt
%if !%{without_nvtt}
%if %{with nvtt}
%check
LD_LIBRARY_PATH=binaries/system binaries/system/test%{dbg} -libdir binaries/system
%endif
@ -172,7 +172,7 @@ for name in AtlasUI%{dbg} Collada%{dbg}; do
install -p -m 755 binaries/system/lib${name}.so %{buildroot}%{_libdir}/%{name}/lib${name}.so
done
%if !%{without_nvtt} && !%{with_system_nvtt}
%if %{with nvtt} && %{without system_nvtt}
for name in nvcore nvimage nvmath nvtt; do
install -p -m 755 binaries/system/lib${name}.so %{buildroot}%{_libdir}/%{name}/lib${name}.so
done
@ -204,7 +204,7 @@ LD_LIBRARY_PATH=%{_libdir}/0ad %{_bindir}/pyrogenesis%{dbg} "\$@"
EOF
chmod +x %{buildroot}%{_bindir}/0ad
%if %{with_debug}
%if %{with debug}
export STRIP=/bin/true
%endif