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