http://packetstormsecurity.org/UNIX/admin/xscreensaver-3.34.tar.gz
[xscreensaver] / xscreensaver.spec
1 %define name            xscreensaver
2 %define version         3.34
3 %define release         1
4 %define serial          1
5 %define x11_prefix      /usr/X11R6
6 %define gnome_prefix    /usr
7 %define kde_prefix      /usr
8
9 %define gnome_datadir   %{gnome_prefix}/share
10 %define gnome_ccdir     %{gnome_datadir}/control-center/Desktop
11 %define gnome_paneldir  %{gnome_datadir}/gnome/apps/Settings/Desktop
12 %define gnome_icondir   %{gnome_datadir}/pixmaps
13
14 # By default, builds the basic, non-GL package.
15 # To build both the basic and GL-add-on packages:
16 #   rpm --define "USE_GL yes" ...
17 # or uncomment the following line.
18 # %define       USE_GL          yes
19
20 Summary:        X screen saver and locker
21 Name:           %{name}
22 Version:        %{version}
23 Release:        %{release}
24 Serial:         %{serial}
25 Group:          Amusements/Graphics
26 Copyright:      BSD
27 URL:            http://www.jwz.org/xscreensaver
28 Vendor:         Jamie Zawinski <jwz@jwz.org>
29 Source:         %{name}-%{version}.tar.gz
30 Buildroot:      %{_tmppath}/%{name}-%{version}-root
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 120 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 %{?USE_GL:%package gl}
41 %{?USE_GL:Group:        Amusements/Graphics}
42 %{?USE_GL:Requires:     xscreensaver = %{version}}
43 %{?USE_GL:Summary:      A set of GL screensavers}
44 %{?USE_GL:%description gl}
45 %{?USE_GL:The xscreensaver-gl package contains even more screensavers for your}
46 %{?USE_GL:mind-numbing, ambition-eroding, time-wasting, hypnotized viewing}
47 %{?USE_GL:pleasure. These screensavers require OpenGL or Mesa support.}
48 %{?USE_GL: }
49 %{?USE_GL:Install the xscreensaver-gl package if you need more screensavers}
50 %{?USE_GL:for use with the X Window System and you have OpenGL or Mesa}
51 %{?USE_GL:installed.}
52
53 %prep
54 %setup -q
55
56 %build
57 RPMOPTS=""
58
59 # Is this really needed?  If so, why?
60 # %ifarch alpha
61 #  RPMOPTS="$RPMOPTS --without-xshm-ext"
62 # %endif
63
64 # On Solaris, build without PAM and with Shadow.
65 # On other systems, build with PAM and without Shadow.
66 #
67 %ifos solaris
68  RPMOPTS="$RPMOPTS --without-pam"
69 %else
70  RPMOPTS="$RPMOPTS --with-pam --without-shadow"
71 %endif
72
73 %{?USE_GL:RPMOPTS="$RPMOPTS --with-gl"}
74 %{!?USE_GL:RPMOPTS="$RPMOPTS --without-gl"}
75
76 CFLAGS="$RPM_OPT_FLAGS" \
77  ./configure --prefix=%{x11_prefix} \
78              --enable-subdir=../lib/xscreensaver \
79              --with-zippy=/usr/games/fortune \
80              --without-setuid-hacks \
81              $RPMOPTS
82
83 make
84
85 %install
86
87 # Most xscreensaver executables go in the X bin directory (/usr/X11R6/bin/)
88 # but some of them (e.g., the control panel capplet) go in the GNOME bin
89 # directory instead (/usr/bin/).
90 #
91 mkdir -p $RPM_BUILD_ROOT%{gnome_prefix}/bin
92 mkdir -p $RPM_BUILD_ROOT%{gnome_ccdir}
93 mkdir -p $RPM_BUILD_ROOT%{gnome_paneldir}
94
95 # Likewise for KDE: the .kss file goes in the KDE bin directory (/usr/bin/).
96 #
97 export KDEDIR=%{kde_prefix}
98 mkdir -p $RPM_BUILD_ROOT$KDEDIR/bin
99
100 # This is a directory that "make install" won't make as needed
101 # (since Linux uses /etc/pam.d/* and Solaris uses /etc/pam.conf).
102 #
103 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
104
105 make  install_prefix=$RPM_BUILD_ROOT \
106       AD_DIR=%{x11_prefix}/lib/X11/app-defaults \
107       GNOME_BINDIR=%{gnome_prefix}/bin \
108       install-strip
109
110 # Make a pair of lists, of the GL and non-GL executables.
111 # Do this by parsing the output of a dummy run of "make install"
112 # in the driver/, hacks/ and hacks/glx/ directories.
113 #
114 list_files() {
115   make -s install_prefix=$RPM_BUILD_ROOT INSTALL=true           \
116           GNOME_BINDIR=%{gnome_prefix}/bin                      \
117           "$@"                                                  |
118     sed -n -e 's@.* /\([^ ]*\)$@/\1@p'                          |
119     sed    -e "s@^$RPM_BUILD_ROOT@@"                            \
120            -e "s@/bin/\.\./@/@"                                 |
121     sed    -e 's@\(.*/man/.*\)@\1\*@'                           |
122     sort
123 }
124
125 ( cd hacks ; list_files install ; \
126   cd ../driver; list_files install-program install-scripts ) \
127    > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-non-gl
128 ( cd hacks/glx ; list_files install ) \
129    > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-gl
130
131
132 # This line is redundant, except that it causes the "xscreensaver"
133 # executable to be installed unstripped (while all others are stripped.)
134 # You should install it this way so that jwz gets useful bug reports.
135 #
136 install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT%{x11_prefix}/bin
137
138 # Even if we weren't compiled with PAM support, make sure to include
139 # the PAM module file in the RPM anyway, just in case.
140 #
141 ( cd driver ;
142   make install_prefix=$RPM_BUILD_ROOT PAM_DIR=/etc/pam.d install-pam )
143
144 # Make sure all files are readable by all, and writable only by owner.
145 #
146 chmod -R a+r,u+w,og-w $RPM_BUILD_ROOT
147
148
149 # This is a tricky part...
150 #
151 # xscreensaver installs several files that are also installed by the
152 # "control-center" RPM.  The versions from xscreensaver are better,
153 # and so should override control-center.  But, the way RPM works,
154 # if the xscreensaver RPM contained those files, the end user would
155 # have to "--force" to make the xscreensaver RPM install.  That's
156 # not something people are used to doing, so that's Bad.
157 #
158 # So instead, we rename the files so that they don't conflict with
159 # the control center.  Then we have a "%post" script that creates
160 # symbolic links to our files.
161
162 CCDIR=$RPM_BUILD_ROOT%{gnome_ccdir}
163 PADIR=$RPM_BUILD_ROOT%{gnome_paneldir}
164 CADIR=$RPM_BUILD_ROOT%{gnome_prefix}/bin
165 DESKF=screensaver-properties.desktop
166 CAPLT=screensaver-properties-capplet
167
168 if [ -f $CCDIR/$DESKF ]; then
169   mv $CCDIR/$DESKF $CCDIR/x$DESKF
170   mv $PADIR/$DESKF $PADIR/x$DESKF
171   mv $CADIR/$CAPLT $CADIR/x$CAPLT
172 fi
173
174 %post
175 # This part runs on the end user's system, when the RPM is installed.
176 # (See comment above, at end of "%install" section.)
177
178 verbose=0
179
180 overwrite_links() {
181   dir="$1"
182   oname="$2"
183   nname="$3"
184
185   # only do this if the file we're making a link *to* exists
186   # (i.e., was present in this rpm.)
187   #
188   if [ -f "$dir/$nname" ]; then
189
190     # backup or delete the old version, if any.
191     #
192     existed=0
193     if [ -f "$dir/$oname" ]; then
194       existed=1
195       if [ -f "$dir/$oname.rpmsave" ]; then
196         rm -f "$dir/$oname"
197         if [ $verbose -gt 1 ]; then
198           echo "$dir/$oname.rpmsave already exists"  >&2
199         fi
200       else
201         mv "$dir/$oname" "$dir/$oname.rpmsave"
202         if [ $verbose -gt 1 ]; then
203           echo "saved $dir/$oname as $oname.rpmsave" >&2
204         fi
205       fi
206     fi
207
208     # install a relative symlink to the new name.
209     #
210     ln -s "$nname" "$dir/$oname"
211     if [ $verbose -ge 1 ]; then
212       if [ $existed = 1 ] ; then
213         echo "replaced $dir/$oname" >&2
214       else
215         echo "created $dir/$oname"  >&2
216       fi
217     fi
218   fi
219 }
220
221 CCDIR=%{gnome_ccdir}
222 PADIR=%{gnome_paneldir}
223 CADIR=%{gnome_prefix}/bin
224 DESKF=screensaver-properties.desktop
225 CAPLT=screensaver-properties-capplet
226
227 overwrite_links $CCDIR $DESKF x$DESKF
228 overwrite_links $PADIR $DESKF x$DESKF
229 overwrite_links $CADIR $CAPLT x$CAPLT
230
231
232 %clean
233 if [ -d $RPM_BUILD_ROOT    ]; then rm -r $RPM_BUILD_ROOT    ; fi
234 if [ -d $RPM_BUILD_ROOT-gl ]; then rm -r $RPM_BUILD_ROOT-gl ; fi
235
236 %files -f exes-non-gl
237 %defattr(-,root,root)
238
239 # Files for the "xscreensaver" package:
240 #
241 %doc                README README.debugging
242 %dir                %{x11_prefix}/lib/xscreensaver
243 %config             %{x11_prefix}/lib/X11/app-defaults/*
244                     %{x11_prefix}/man/man1/xscreensaver*
245                     /etc/pam.d/*
246
247 %config(missingok)  %{kde_prefix}/bin/*.kss
248
249 %config(missingok)  %{gnome_prefix}/bin/*-capplet
250 %config(missingok)  %{gnome_ccdir}/*.desktop
251 %config(missingok)  %{gnome_paneldir}/*.desktop
252 %config(missingok)  %{gnome_icondir}/*
253
254 # Files for the "xscreensaver-gl" package:
255 #
256 %{?USE_GL:%files -f exes-gl gl}