http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.01.tar.gz
[xscreensaver] / xscreensaver.spec
1 %define name            xscreensaver
2 %define version         4.01
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_1   %{gnome_datadir}/control-center/Desktop
11 %define gnome_ccdir_2   %{gnome_datadir}/control-center/capplets
12 %define gnome_paneldir  %{gnome_datadir}/gnome/apps/Settings/Desktop
13 %define gnome_icondir   %{gnome_datadir}/pixmaps
14
15 # By default, builds the basic, non-GL package.
16 # To build both the basic and GL-add-on packages:
17 #   rpm --define "USE_GL yes" ...
18 # or uncomment the following line.
19 # %define       USE_GL          yes
20
21 Summary:        X screen saver and locker
22 Name:           %{name}
23 Version:        %{version}
24 Release:        %{release}
25 Serial:         %{serial}
26 Group:          Amusements/Graphics
27 Copyright:      BSD
28 URL:            http://www.jwz.org/xscreensaver
29 Vendor:         Jamie Zawinski <jwz@jwz.org>
30 Source:         %{name}-%{version}.tar.gz
31 Buildroot:      %{_tmppath}/%{name}-%{version}-root
32
33 # This package really should be made to depend on
34 # control-center >= 1.4.0.2 -OR- control-center >= 1.5.12
35 # but there's no way to express that.
36
37 %description
38 A modular screen saver and locker for the X Window System.
39 Highly customizable: allows the use of any program that
40 can draw on the root window as a display mode.
41 More than 140 display modes are included in this package.
42 %{?USE_GL:See also the xscreensaver-gl package, which}
43 %{?USE_GL:includes optional OpenGL display modes.}
44
45 %{?USE_GL:%package gl}
46 %{?USE_GL:Group:        Amusements/Graphics}
47 %{?USE_GL:Requires:     xscreensaver = %{version}}
48 %{?USE_GL:Summary:      A set of GL screensavers}
49 %{?USE_GL:%description gl}
50 %{?USE_GL:The xscreensaver-gl package contains even more screensavers for your}
51 %{?USE_GL:mind-numbing, ambition-eroding, time-wasting, hypnotized viewing}
52 %{?USE_GL:pleasure. These screensavers require OpenGL or Mesa support.}
53 %{?USE_GL: }
54 %{?USE_GL:Install the xscreensaver-gl package if you need more screensavers}
55 %{?USE_GL:for use with the X Window System and you have OpenGL or Mesa}
56 %{?USE_GL:installed.}
57
58 %prep
59 %setup -q
60
61 %build
62 RPMOPTS=""
63
64 # Is this really needed?  If so, why?
65 # %ifarch alpha
66 #  RPMOPTS="$RPMOPTS --without-xshm-ext"
67 # %endif
68
69 # On Solaris, build without PAM and with Shadow.
70 # On other systems, build with PAM and without Shadow.
71 #
72 %ifos solaris
73  RPMOPTS="$RPMOPTS --without-pam"
74 %else
75  RPMOPTS="$RPMOPTS --with-pam --without-shadow"
76 %endif
77
78 %{?USE_GL:RPMOPTS="$RPMOPTS --with-gl"}
79 %{!?USE_GL:RPMOPTS="$RPMOPTS --without-gl"}
80
81 CFLAGS="$RPM_OPT_FLAGS" \
82  ./configure --prefix=%{x11_prefix} \
83              --with-setuid-hacks \
84              $RPMOPTS
85
86 make
87
88 %install
89
90 # Most xscreensaver executables go in the X bin directory (/usr/X11R6/bin/)
91 # but some of them (e.g., the control panel capplet) go in the GNOME bin
92 # directory instead (/usr/bin/).
93 #
94 mkdir -p $RPM_BUILD_ROOT%{gnome_prefix}/bin
95 mkdir -p $RPM_BUILD_ROOT%{gnome_ccdir_1}
96 mkdir -p $RPM_BUILD_ROOT%{gnome_ccdir_2}
97 mkdir -p $RPM_BUILD_ROOT%{gnome_paneldir}
98
99 # Likewise for KDE: the .kss file goes in the KDE bin directory (/usr/bin/).
100 #
101 export KDEDIR=%{kde_prefix}
102 mkdir -p $RPM_BUILD_ROOT$KDEDIR/bin
103
104 # This is a directory that "make install" won't make as needed
105 # (since Linux uses /etc/pam.d/* and Solaris uses /etc/pam.conf).
106 #
107 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
108
109 make  install_prefix=$RPM_BUILD_ROOT \
110       AD_DIR=%{x11_prefix}/lib/X11/app-defaults \
111       GNOME_BINDIR=%{gnome_prefix}/bin \
112       install-strip
113
114 # Make a pair of lists, of the GL and non-GL executables.
115 # Do this by parsing the output of a dummy run of "make install"
116 # in the driver/, hacks/ and hacks/glx/ directories.
117 #
118 list_files() {
119   make -s install_prefix=$RPM_BUILD_ROOT INSTALL=true           \
120           GNOME_BINDIR=%{gnome_prefix}/bin                      \
121           "$@"                                                  |
122     sed -n -e 's@.* /\([^ ]*\)$@/\1@p'                          |
123     sed    -e "s@^$RPM_BUILD_ROOT@@"                            \
124            -e "s@/bin/\.\./@/@"                                 |
125     sed    -e 's@\(.*/man/.*\)@\1\*@'                           |
126     sort
127 }
128
129 ( cd hacks ; list_files install ; \
130   cd ../driver; list_files install-program install-scripts ) \
131    > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-non-gl
132 ( cd hacks/glx ; list_files install ) \
133    | grep -v man1/xscreensaver-gl-helper \
134    > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-gl
135
136
137 # This line is redundant, except that it causes the "xscreensaver"
138 # executable to be installed unstripped (while all others are stripped.)
139 # You should install it this way so that jwz gets useful bug reports.
140 #
141 install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT%{x11_prefix}/bin
142
143 # Even if we weren't compiled with PAM support, make sure to include
144 # the PAM module file in the RPM anyway, just in case.
145 #
146 ( cd driver ;
147   make install_prefix=$RPM_BUILD_ROOT PAM_DIR=/etc/pam.d install-pam )
148
149 # Make sure all files are readable by all, and writable only by owner.
150 #
151 chmod -R a+r,u+w,og-w $RPM_BUILD_ROOT
152
153 %post
154 # This part runs on the end user's system, when the RPM is installed.
155
156 pids=`pidof xscreensaver`
157 if [ -n "$pids" ]; then
158   echo "sending SIGHUP to running xscreensaver ($pids)..." >&2
159   kill -HUP $pids
160 fi
161
162 %clean
163 if [ -d $RPM_BUILD_ROOT    ]; then rm -r $RPM_BUILD_ROOT    ; fi
164 if [ -d $RPM_BUILD_ROOT-gl ]; then rm -r $RPM_BUILD_ROOT-gl ; fi
165
166 %files -f exes-non-gl
167 %defattr(-,root,root)
168
169 # Files for the "xscreensaver" package:
170 #
171 %doc                README README.debugging
172 %dir                %{x11_prefix}/lib/xscreensaver
173 %config             %{x11_prefix}/lib/X11/app-defaults/*
174                     %{x11_prefix}/man/man1/xscreensaver*
175                     /etc/pam.d/*
176
177 %config(missingok)  %{kde_prefix}/bin/*.kss
178
179 %config(missingok)  %{gnome_prefix}/bin/*-capplet
180 %config(missingok)  %{gnome_ccdir_1}/*.desktop
181 %config(missingok)  %{gnome_ccdir_2}/*.desktop
182 %config(missingok)  %{gnome_paneldir}/*.desktop
183 %config(missingok)  %{gnome_icondir}/*
184
185 # Files for the "xscreensaver-gl" package:
186 #
187 %{?USE_GL:%files -f exes-gl gl}