http://ftp.x.org/contrib/applications/xscreensaver-3.22.tar.gz
[xscreensaver] / xscreensaver.spec
1 %define name    xscreensaver
2 %define version 3.22
3 %define release 1
4 %define serial  1
5 %define prefix  /usr/X11R6
6
7 # By default, builds the basic, non-GL package.
8 # To build both the basic and GL-add-on packages:
9 #   rpm --define "USE_GL yes" ...
10
11 Summary:        X screen saver and locker
12 Name:           %{name}
13 Version:        %{version}
14 Release:        %{release}
15 Serial:         %{serial}
16 Group:          Amusements/Graphics
17 Copyright:      BSD
18 URL:            http://www.jwz.org/xscreensaver
19 Vendor:         Jamie Zawinski <jwz@jwz.org>
20 Source:         %{name}-%{version}.tar.gz
21 Buildroot:      /var/tmp/%{name}-%{version}-root
22
23 %description
24 A modular screen saver and locker for the X Window System.
25 Highly customizable: allows the use of any program that
26 can draw on the root window as a display mode.
27 More than 100 display modes are included in this package.
28 %{?USE_GL:See also the xscreensaver-gl package, which}
29 %{?USE_GL:includes optional OpenGL display modes.}
30
31 %{?USE_GL:%package gl}
32 %{?USE_GL:Group:        Amusements/Graphics}
33 %{?USE_GL:Requires:     xscreensaver = %{version}}
34 %{?USE_GL:Summary:      A set of GL screensavers}
35 %{?USE_GL:%description gl}
36 %{?USE_GL:The xscreensaver-gl package contains even more screensavers for your}
37 %{?USE_GL:mind-numbing, ambition-eroding, time-wasting, hypnotized viewing}
38 %{?USE_GL:pleasure. These screensavers require OpenGL or Mesa support.}
39 %{?USE_GL: }
40 %{?USE_GL:Install the xscreensaver-gl package if you need more screensavers}
41 %{?USE_GL:for use with the X Window System and you have OpenGL or Mesa}
42 %{?USE_GL:installed.}
43
44 %prep
45 %setup -q
46
47 %build
48 RPMOPTS=""
49
50 # Is this really needed?  If so, why?
51 # %ifarch alpha
52 #  RPMOPTS="$RPMOPTS --without-xshm-ext"
53 # %endif
54
55 # On Solaris, build without PAM and with Shadow.
56 # On other systems, build with PAM and without Shadow.
57 #
58 %ifos solaris
59  RPMOPTS="$RPMOPTS --without-pam"
60 %else
61  RPMOPTS="$RPMOPTS --with-pam --without-shadow"
62 %endif
63
64 %{?USE_GL:RPMOPTS="$RPMOPTS --with-gl"}
65 %{!?USE_GL:RPMOPTS="$RPMOPTS --without-gl"}
66
67 CFLAGS="$RPM_OPT_FLAGS" \
68  ./configure --prefix=%{prefix} \
69              --enable-subdir=../lib/xscreensaver \
70              $RPMOPTS
71
72 make
73
74 %install
75
76 # This is a directory that "make install" won't make as needed
77 # (since Linux uses /etc/pam.d/* and Solaris uses /etc/pam.conf).
78 #
79 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
80
81 # This is another (since "make install" doesn't try to install
82 # the xscreensaver.kss file unless $KDEDIR is set.)
83 #
84 if [ -z "$KDEDIR" ]; then export KDEDIR=/usr; fi
85 mkdir -p $RPM_BUILD_ROOT$KDEDIR/bin
86
87 make  install_prefix=$RPM_BUILD_ROOT \
88       AD_DIR=%{prefix}/lib/X11/app-defaults \
89       install-strip
90
91 # Make a pair of lists, of the GL and non-GL hacks.
92 # Do this by parsing the output of a dummy run of "make install"
93 # in the hacks/ and hacks/glx/ directories.
94 #
95 list_files() {
96   make -s install_prefix=$RPM_BUILD_ROOT INSTALL=true install   |
97     sed -n -e 's@.* /\([^ ]*\)$@/\1@p'                          |
98     sed    -e "s@^$RPM_BUILD_ROOT@@"                            \
99            -e "s@/bin/..@@"                                     |
100     sort
101 }
102
103 ( cd hacks ; list_files > $RPM_BUILD_DIR/xscreensaver-%{version}/hacks-non-gl )
104 ( cd hacks/glx ; list_files > $RPM_BUILD_DIR/xscreensaver-%{version}/hacks-gl )
105
106
107
108 # This line is redundant, except that it causes the "xscreensaver"
109 # executable to be installed unstripped (while all others are stripped.)
110 # You should install it this way so that jwz gets useful bug reports.
111 #
112 install -m 4755 driver/xscreensaver $RPM_BUILD_ROOT%{prefix}/bin
113
114 # Even if we weren't compiled with PAM support, make sure to include
115 # the PAM module file in the RPM anyway, just in case.
116 #
117 ( cd driver ;
118   make install_prefix=$RPM_BUILD_ROOT PAM_DIR=/etc/pam.d install-pam )
119
120 # This is for wmconfig, a tool that generates init files for window managers.
121 #
122 mkdir -p $RPM_BUILD_ROOT/etc/X11/wmconfig
123 cat > $RPM_BUILD_ROOT/etc/X11/wmconfig/xscreensaver <<EOF
124 xscreensaver name "xscreensaver (1min timeout)"
125 xscreensaver description "xscreensaver"
126 xscreensaver group "Amusements/Screen Savers"
127 xscreensaver exec "xscreensaver -timeout 1 -cycle 1 &"
128 EOF
129
130 # This is for the GNOME desktop:
131 #
132 mkdir -p "$RPM_BUILD_ROOT/usr/share/apps/Amusements/Screen Savers"
133 cat > "$RPM_BUILD_ROOT/usr/share/apps/Amusements/Screen Savers/xscreensaver.desktop" <<EOF
134 [Desktop Entry]
135 Name=xscreensaver (1min timeout)
136 Description=xscreensaver
137 Exec=xscreensaver -timeout 1 -cycle 1
138 EOF
139
140 # Make sure all files are readable by all, and writable only by owner.
141 #
142 chmod -R a+r,u+w,og-w $RPM_BUILD_ROOT
143
144 %clean
145 if [ -d $RPM_BUILD_ROOT    ]; then rm -r $RPM_BUILD_ROOT    ; fi
146 if [ -d $RPM_BUILD_ROOT-gl ]; then rm -r $RPM_BUILD_ROOT-gl ; fi
147
148 %files -f hacks-non-gl
149 %defattr(-,root,root)
150
151 # Files for the "xscreensaver" package:
152 #
153 %doc                README README.debugging
154                     %{prefix}/bin/*
155 %dir                %{prefix}/lib/xscreensaver
156 %config             %{prefix}/lib/X11/app-defaults/*
157                     %{prefix}/man/man1/xscreensaver*
158                     /etc/pam.d/*
159 %config(missingok)  /usr/bin/*.kss
160 %config(missingok)  /etc/X11/wmconfig/*
161 %config(missingok)  "/usr/share/apps/Amusements/Screen Savers/*"
162
163 # Files for the "xscreensaver-gl" package:
164 #
165 %{?USE_GL:%files -f hacks-gl gl}