Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > efb1e9c481fe0cf68088410ca0ee6275 > files > 2

mj-1.10-6.fc13.src.rpm

Name:        mj
Version:     1.10
Release:     6%{?dist}
Summary:     Mah-Jong program with network option
Summary(sv): Mah-Jong-program med nätmöjlighet

Group:       Amusements/Games
License:     GPLv2+
URL:         http://mahjong.julianbradfield.org/
# Upstreams: http://mahjong.julianbradfield.org/Source/%name-%version-src.tar.gz
Source0:     %name-GPL-%version-src.tar.bz2
# The bundled tiles have a non-commercial-use license.  So instead we
# use GPL tiles from kdegames instead.  The solution was suggested by
# Tom 'spot' Callaway in:
# http://lists.fedoraproject.org/pipermail/legal/2010-February/001109.html
# To produce the bundled sources from the upstreams, place them in a directory
# and run the command:
# ./remove-non-GPL.sh %version
Source1:     remove-non-GPL.sh

BuildRequires: perl
BuildRequires: gtk2-devel
BuildRequires: kdegames
BuildRequires: inkscape
BuildRequires: ImageMagick
BuildRequires: desktop-file-utils

%global desktopdir %_datadir/applications
%global icontop %_datadir/icons/hicolor
%global icondir %icontop/32x32/apps

%description
This is the game of Mah-Jong, not be confused with the solitaire
matching game using the same tiles.  It is a set of three programs
which provide a networked Mah-Jong system, together with a computer
player.  Thus the game can be played by four humans, by a human and
three computer players, or any other combination.


%description -l sv
Detta är spelet Mah-Jong, inte att förväxla med det patiensliknande
matchningsspelet som använder samma brickor.  Det är en uppsättning
med tre program som utgör ett nätverksbaserat Mah-Jong-system,
tillsammans med en datorspelare.  Spelet kan alltså spelas av fyra
människor, av en människa och tre datorspelare, eller någon
kombination av de två.


%global tiles /usr/share/kde4/apps/kmahjongglib/tilesets/default.svgz
%global gettile() inkscape --without-gui --export-png=tile.png --export-id=%1 --file=tiles.svg --export-height=37 --export-width=27 --export-background=ivory; convert tile.png -crop 25x35+1+1 %2.xpm;


%prep
%setup -q -n %name-%version-src
# Convert the kdegames tiles to the format of the bundled ones.
mkdir tiles-kdegames
cd tiles-kdegames
# For some reason I can't figure out, inkscape fails to uncompress the svgz
# file when run in a mock chroot.  When I run on the command line it works
# fine.  To work around, I uncompress the svgz file in a separate step.
zcat %tiles > tiles.svg
for suit in "BAMBOO B 9" "CHARACTER C 9" "ROD D 9" "FLOWER F 4" "SEASON S 4"
do  set $suit
    for n in $(seq 1 $3)
    do  %gettile $1_$n $n$2
    done
done
%gettile WIND_1 NW
%gettile WIND_2 SW
%gettile WIND_3 EW
%gettile WIND_4 WW
%gettile DRAGON_1 WD
%gettile DRAGON_2 GD
%gettile DRAGON_3 RD
# Pixmap representing the back of a tile.  Use chocolate3 as a bamboo color.
convert WD.xpm -fill chocolate3 -opaque ivory ./--.xpm
# Pixmap used for programming errors.  Use red.  Should never show up.
convert WD.xpm -fill red -opaque ivory XX.xpm
# The "tongs" are ok according to the README file.
cp -p ../tiles-v1/tong* .


%build
make %{?_smp_mflags} EXTRA_CFLAGS="%optflags" LDLIBS=-lm \
     FALLBACKTILES=./tiles-kdegames
cat << EOF > %name.desktop
[Desktop Entry]
Name=Mah-Jong
GenericName=The game of Mah-Jong
GenericName[sv]=Spelet Mah-Jong
Comment=Play Mah-Jong against the computer or over the network
Comment[sv]=Spela Mah-Jong mot datorn eller över nätet
Exec=xmj
Icon=mj
Terminal=false
Type=Application
Categories=Game;
EOF


%install
make install install.man DESTDIR=%buildroot%_prefix/ MANDIR=share/man/man1 \
     INSTPGMFLAGS=
mkdir %buildroot%desktopdir
desktop-file-install --dir=%buildroot%desktopdir %name.desktop
mkdir -p %buildroot%icondir
convert icon.ico %buildroot%icondir/%name.png


%post
touch --no-create %icontop &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %icontop &>/dev/null
    gtk-update-icon-cache %icontop &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %icontop &>/dev/null || :


%files
%defattr(-,root,root,-)
%doc ChangeLog CHANGES LICENCE README rules.txt use.txt
%_bindir/*
%_mandir/man1/*
%desktopdir/%name.desktop
%icondir/%name.png


%changelog
* Mon Sep 13 2010 Göran Uddeborg <goeran@uddeborg.se> 1.10-6
- The desktop file called the executable "mj", not "xmj". BZ 633115

* Sun May  2 2010 Göran Uddeborg <goeran@uddeborg.se> 1.10-5
- Don't strip executables on installation, BZ 578290 comment 25.

* Thu Apr 22 2010 Göran Uddeborg <goeran@uddeborg.se> 1.10-4
- Remove non-free tile images from the upstreams tar file.

* Mon Apr 10 2010 Göran Uddeborg <goeran@uddeborg.se> 1.10-3
- Updated according to comments in review.
- Use names instead of hex codes on colors.

* Mon Apr  5 2010 Göran Uddeborg <goeran@uddeborg.se> 1.10-2
- Updated scriptlets to follow current packaging guidelines.

* Tue Mar 30 2010 Göran Uddeborg <goeran@uddeborg.se> 1.10-1
- Packaged mj as an RPM.