http://ftp.ussg.iu.edu/linux/slackware/slackware-9.0/source/xap/xscreensaver/xscreens...
[xscreensaver] / xscreensaver.spec
1 %define name            xscreensaver
2 %define version         4.08
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 %define gnome_datadir   %{gnome_prefix}/share
9
10 # By default, builds the basic, non-GL package.
11 # To build both the basic and GL-add-on packages:
12 #   rpm --define "USE_GL yes" ...
13 # or uncomment the following line.
14 # %define       USE_GL          yes
15
16 Summary:        X screen saver and locker
17 Name:           %{name}
18 Version:        %{version}
19 Release:        %{release}
20 Serial:         %{serial}
21 Group:          Amusements/Graphics
22 Copyright:      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 150 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 # On Solaris, build without PAM and with Shadow.
60 # On other systems, build with PAM and without Shadow.
61 #
62 %ifos solaris
63  RPMOPTS="$RPMOPTS --without-pam"
64 %else
65  RPMOPTS="$RPMOPTS --with-pam --without-shadow"
66 %endif
67
68 %{?USE_GL:RPMOPTS="$RPMOPTS --with-gl"}
69 %{!?USE_GL:RPMOPTS="$RPMOPTS --without-gl"}
70
71 archdir=`./config.guess`
72 mkdir $archdir
73 cd $archdir
74 CFLAGS="$RPM_OPT_FLAGS" \
75  ../configure --prefix=%{x11_prefix} \
76               --with-setuid-hacks \
77               $RPMOPTS
78 make
79
80 %install
81
82 archdir=`./config.guess`
83
84 # We have to make sure these directories exist,
85 # or nothing will be installed into them.
86 #
87 export KDEDIR=%{kde_prefix}
88 mkdir -p $RPM_BUILD_ROOT$KDEDIR/bin
89 mkdir -p $RPM_BUILD_ROOT%{gnome_datadir}
90 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
91
92 cd $archdir
93 make  install_prefix=$RPM_BUILD_ROOT \
94       AD_DIR=%{x11_prefix}/lib/X11/app-defaults \
95       GNOME_BINDIR=%{gnome_prefix}/bin \
96       install-strip
97
98 # This function prints a list of things that get installed.
99 # It does this by parsing the output of a dummy run of "make install".
100 #
101 list_files() {
102   make -s install_prefix=$RPM_BUILD_ROOT INSTALL=true           \
103           GNOME_BINDIR=%{gnome_prefix}/bin                      \
104           "$@"                                                  |
105     sed -n -e 's@.* \(/[^ ]*\)$@\1@p'                           |
106     sed    -e "s@^$RPM_BUILD_ROOT@@"                            \
107            -e "s@/[a-z][a-z]*/\.\./@/@"                         |
108     sed    -e 's@\(.*/man/.*\)@\1\*@'                           |
109     sort
110 }
111
112 # Collect the names of the non-GL executables and scripts...
113 # (Including the names of all of the Gnome, KDE, and L10N-related files,
114 # whereever they might have gotten installed...)
115 # For the translation catalogs, prepend an appropriate %lang(..) tag.
116 #
117 (  cd    hacks ; list_files install ; \
118    cd ../driver; list_files install-program install-scripts \
119                             install-gnome install-kde ; \
120  ( cd ../po;     list_files install | grep '\.' \
121     | sed 's@^\(.*/\([^/]*\)/LC.*\)$@%lang(\2) \1@' ) \
122 ) > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-non-gl
123
124
125 # Collect the names of the GL-only executables...
126 #
127 ( cd hacks/glx ; list_files install ) \
128    | grep -v man1/xscreensaver-gl-helper \
129    > $RPM_BUILD_DIR/xscreensaver-%{version}/exes-gl
130
131 # This line is redundant, except that it causes the "xscreensaver"
132 # executable to be installed unstripped (while all others are stripped.)
133 # You should install it this way so that jwz gets useful bug reports.
134 #
135 install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT%{x11_prefix}/bin
136
137 # Even if we weren't compiled with PAM support, make sure to include
138 # the PAM module file in the RPM anyway, just in case.
139 #
140 ( cd driver ;
141   make install_prefix=$RPM_BUILD_ROOT PAM_DIR=/etc/pam.d install-pam )
142
143 # Make sure all files are readable by all, and writable only by owner.
144 #
145 chmod -R a+r,u+w,og-w $RPM_BUILD_ROOT
146
147 %post
148 # This part runs on the end user's system, when the RPM is installed.
149
150 pids=`pidof xscreensaver`
151 if [ -n "$pids" ]; then
152   echo "sending SIGHUP to running xscreensaver ($pids)..." >&2
153   kill -HUP $pids
154 fi
155
156 %clean
157 if [ -d $RPM_BUILD_ROOT    ]; then rm -r $RPM_BUILD_ROOT    ; fi
158 if [ -d $RPM_BUILD_ROOT-gl ]; then rm -r $RPM_BUILD_ROOT-gl ; fi
159
160 # Files for the "xscreensaver" package:
161 #
162 %files -f exes-non-gl
163 %defattr(-,root,root)
164
165 %doc    README README.debugging
166 %dir    %{x11_prefix}/lib/xscreensaver
167 %config %{x11_prefix}/lib/X11/app-defaults/*
168         %{x11_prefix}/man/man1/xscreensaver*
169 %config /etc/pam.d/*
170
171 # Files for the "xscreensaver-gl" package:
172 #
173 %{?USE_GL:%files -f exes-gl gl}
174 %{?USE_GL:%defattr(-,root,root)}