http://ftp.ksu.edu.tw/FTP/FreeBSD/distfiles/xscreensaver-4.20.tar.gz
[xscreensaver] / xscreensaver.spec
1 %define name            xscreensaver
2 %define version         4.20
3 %define release         1
4 %define epoch           1
5 %define x11_prefix      /usr/X11R6
6 %define gnome_prefix    /usr
7 %define gnome_datadir   %{gnome_prefix}/share
8
9 # By default, builds the basic, non-GL package.
10 # To build both the basic and GL-add-on packages:
11 #   rpm --define "USE_GL yes" ...
12 # or uncomment the following line.
13 # %define       USE_GL          yes
14
15 Summary:        X screen saver and locker
16 Summary(fr):    Economiseur d'écran et verrouillage de terminaux X
17 Name:           %{name}
18 Version:        %{version}
19 Release:        %{release}
20 Epoch:          %{epoch}
21 Group:          Amusements/Graphics
22 License:        BSD
23 URL:            http://www.jwz.org/xscreensaver/
24 Vendor:         Jamie Zawinski <jwz@jwz.org>
25 Source:         %{name}-%{version}.tar.gz
26 Buildroot:      %{_tmppath}/%{name}-%{version}-root
27
28 # This package really should be made to depend on
29 # control-center >= 1.4.0.2 -OR- control-center >= 1.5.12
30 # but there's no way to express that.
31
32 %description
33 A modular screen saver and locker for the X Window System.
34 Highly customizable: allows the use of any program that
35 can draw on the root window as a display mode.
36 More than 190 display modes are included in this package.
37 %{?USE_GL:See also the xscreensaver-gl package, which}
38 %{?USE_GL:includes optional OpenGL display modes.}
39
40 %description -l fr
41 Un économiseur d'écran et verrouillage modulaire pour X-Window.
42 Hautement configurable: permet l'utilisation de n'importe quel programme
43 qui peut dessiner dans la fenêtre root.
44 Plus de 190 modes d'affichage sont inclus dans ce paquet.
45 %{?USE_GL:Voir aussi le paquet xscreensaver-gl, qui inclut}
46 %{?USE_GL:des modules optionnels OpenGL.}
47
48 %{?USE_GL:%package gl}
49 %{?USE_GL:Group:        Amusements/Graphics}
50 %{?USE_GL:Requires:     xscreensaver = %{epoch}:%{version}-%{release}}
51 %{?USE_GL:Summary:      A set of GL screensavers}
52 %{?USE_GL:Summary(fr):  Un ensemble d'économiseurs d'écran OpenGL}
53 %{?USE_GL:%description gl}
54 %{?USE_GL:The xscreensaver-gl package contains even more screensavers for your}
55 %{?USE_GL:mind-numbing, ambition-eroding, time-wasting, hypnotized viewing}
56 %{?USE_GL:pleasure. These screensavers require OpenGL or Mesa support.}
57 %{?USE_GL: }
58 %{?USE_GL:Install the xscreensaver-gl package if you need more screensavers}
59 %{?USE_GL:for use with the X Window System and you have OpenGL or Mesa}
60 %{?USE_GL:installed.}
61 %{?USE_GL:%description -l fr gl}
62 %{?USE_GL:Le paquet xscreensaver-gl contient encore plus d'économiseurs}
63 %{?USE_GL:d'écran pour votre plaisir visuel.}
64 %{?USE_GL: }
65 %{?USE_GL:Ces économiseurs d'écran nécessitent OpenGL ou Mesa.}
66 %{?USE_GL:Installez le paquet xscreensaver-gl si vous désirez plus}
67 %{?USE_GL:d'économiseur d'écran et que vous avez OpenGL ou Mesa installé.}
68
69 %prep
70 %setup -q
71
72 %build
73 RPMOPTS=""
74
75 # On Solaris, build without PAM and with Shadow.
76 # On other systems, build with PAM and without Shadow.
77 #
78 %ifos solaris
79  RPMOPTS="$RPMOPTS --without-pam"
80 %else
81  RPMOPTS="$RPMOPTS --with-pam --without-shadow"
82 %endif
83
84 %{?USE_GL:RPMOPTS="$RPMOPTS --with-gl"}
85 %{!?USE_GL:RPMOPTS="$RPMOPTS --without-gl"}
86
87 archdir=`./config.guess`
88 mkdir $archdir
89 cd $archdir
90 CFLAGS="$RPM_OPT_FLAGS" \
91  ../configure --prefix=%{x11_prefix} \
92               --with-setuid-hacks \
93               $RPMOPTS
94 make
95
96 %install
97
98 archdir=`./config.guess`
99
100 # We have to make sure these directories exist,
101 # or nothing will be installed into them.
102 #
103 mkdir -p $RPM_BUILD_ROOT%{gnome_datadir}
104 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
105
106 cd $archdir
107 make  install_prefix=$RPM_BUILD_ROOT \
108       AD_DIR=%{x11_prefix}/lib/X11/app-defaults \
109       GNOME_BINDIR=%{gnome_prefix}/bin \
110       install-strip
111
112 # This function prints a list of things that get installed.
113 # It does this by parsing the output of a dummy run of "make install".
114 #
115 list_files() {
116   make -s install_prefix=$RPM_BUILD_ROOT INSTALL=true           \
117           GNOME_BINDIR=%{gnome_prefix}/bin                      \
118           "$@"                                                  |
119     sed -n -e 's@.* \(/[^ ]*\)$@\1@p'                           |
120     sed    -e "s@^$RPM_BUILD_ROOT@@"                            \
121            -e "s@/[a-z][a-z]*/\.\./@/@"                         |
122     sed    -e 's@\(.*/man/.*\)@\1\*@'                           |
123     sort
124 }
125
126 # Collect the names of the non-GL executables and scripts...
127 # (Including the names of all of the Gnome and L10N-related files,
128 # whereever they might have gotten installed...)
129 # For the translation catalogs, prepend an appropriate %lang(..) tag.
130 #
131 (  cd    hacks ; list_files install ; \
132    cd ../driver; list_files install-program install-scripts install-gnome ; \
133  ( cd ../po;     list_files install | grep '\.' \
134     | sed 's@^\(.*/\([^/]*\)/LC.*\)$@%lang(\2) \1@' ) \
135 ) > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-non-gl
136
137
138 # Collect the names of the GL-only executables...
139 #
140 ( cd hacks/glx ; list_files install ) \
141    | grep -v man1/xscreensaver-gl-helper \
142    > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-gl
143
144 # This line is redundant, except that it causes the "xscreensaver"
145 # executable to be installed unstripped (while all others are stripped.)
146 # You should install it this way so that jwz gets useful bug reports.
147 #
148 install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT%{x11_prefix}/bin
149
150 # Even if we weren't compiled with PAM support, make sure to include
151 # the PAM module file in the RPM anyway, just in case.
152 #
153 ( cd driver ;
154   make install_prefix=$RPM_BUILD_ROOT PAM_DIR=/etc/pam.d install-pam )
155
156 # Make sure all files are readable by all, and writable only by owner.
157 #
158 chmod -R a+r,u+w,og-w $RPM_BUILD_ROOT
159
160 %post
161 # This part runs on the end user's system, when the RPM is installed.
162
163 pids=`/sbin/pidof xscreensaver`
164 if [ -n "$pids" ]; then
165   echo "sending SIGHUP to running xscreensaver ($pids)..." >&2
166   kill -HUP $pids
167 fi
168
169 %clean
170 if [ -d $RPM_BUILD_ROOT    ]; then rm -r $RPM_BUILD_ROOT    ; fi
171 if [ -d $RPM_BUILD_ROOT-gl ]; then rm -r $RPM_BUILD_ROOT-gl ; fi
172
173 # Files for the "xscreensaver" package:
174 #
175 %files -f exes-non-gl
176 %defattr(-,root,root)
177
178 %doc    README README.debugging
179 %dir    %{x11_prefix}/lib/xscreensaver
180 %config %{x11_prefix}/lib/X11/app-defaults/*
181         %{x11_prefix}/man/man1/xscreensaver*
182 %config /etc/pam.d/*
183
184 # Files for the "xscreensaver-gl" package:
185 #
186 %{?USE_GL:%files -f exes-gl gl}
187 %{?USE_GL:%defattr(-,root,root)}