1#!/bin/sh
2#set -x
3
4export DUNEMAKEFLAGS=-j8
5
6RPM_SRC_LIST="/usr/src/rpm /usr/src/RPM /usr/src/redhat /usr/src/packages"
7RPM_SRC_LIST="$RPM_SRC_LIST $HOME/rpmbuild"
8
9unset MKRPM_SRC
10for i in $RPM_SRC_LIST ; do
11   if test -d $i/SOURCES ; then
12      MKRPM_SRC=$i/SOURCES
13   fi
14done
15if test "$MKRPM_SRC" = "" ; then
16   echo -n non of typical rpm source directories 1>&2
17   for i in $RPM_SRC_LIST ; do
18       echo -n " " $i/SOURCES 1>&2
19   done
20   echo " " found 1>&2
21   echo extend variable RPM_SRC_LIST in $0 for your system 1>&2
22   exit 1
23fi
24
25UNAME_A=`uname -a`
26UNAME_PS2="Linux $USER 2.2.1 #1 Wed Nov 14 18:28:00 JST 2001 mips unknown"
27
28VERSION1=`sh ../../batch/getversion.sh`
29. /etc/os-release
30VERSION=$VERSION1
31VERSION2=wdune-$VERSION1
32
33(
34   cd ../../.. &&
35   rm -rf /tmp/$VERSION2 && \
36   cp -r $VERSION2 /tmp/ && \
37   cd /tmp/$VERSION2 &&
38   sh -x batch/fix_not_translated_rcfiles.sh &&
39   make realclean && rm -rf desktop/macosx desktop/irix
40) && \
41(cd /tmp && tar -cpf - $VERSION2) | \
42bzip2 -c > $MKRPM_SRC/$VERSION2.tar.bz2
43
44if test "$UNAME_A"="$UNAME_PS2"; then
45   # disable optimization on Playstation 2 cause of compiler bugs
46   OPTIMIZE="--with-optimization"
47   RPM_OPT_FLAGS=""
48else
49   OPTIMIZE="--with-optimization"
50   RPM_OPT_FLAGS='$RPM_OPT_FLAGS -O2 -g'
51fi
52
53RPM_BUILD_ROOT='$RPM_BUILD_ROOT'
54cat > /tmp/wdune.spec << EOT 
55Summary: A graphical X3D/VRML97 editor, simple 3D modeler and animation tool
56Name: wdune
57Version: $VERSION
58Release: 2%{?dist}
59License: GPLv2+ and GPLv3+ and LGPLv3+ and BSD and Public Domain and ASL 2.0
60URL: http://wdune.ourproject.org/
61Source: ftp://ftp.ourproject.org/pub/wdune/wdune-%{version}.tar.bz2
62BuildRequires: gcc-c++
63BuildRequires: gawk
64BuildRequires: make
65BuildRequires: bash
66BuildRequires: motif-devel
67BuildRequires: libXi-devel
68BuildRequires: libpng-devel
69BuildRequires: libjpeg-devel
70BuildRequires: mesa-libGLU-devel
71BuildRequires: expat-devel
72BuildRequires: flex
73BuildRequires: bison
74BuildRequires: libusb-devel
75BuildRequires: CGAL-devel
76BuildRequires: gmp-devel
77BuildRequires: libcurl-devel
78BuildRequires: eigen3-devel
79BuildRequires: opensubdiv-devel
80BuildRequires: ImageMagick
81BuildRequires: aqsis-core
82BuildRequires: freetype-devel 
83BuildRequires: bitstream-vera-sans-fonts
84BuildRequires: desktop-file-utils
85BuildRequires: xdg-utils
86BuildRequires: grep
87BuildRequires: pkg-config
88BuildRequires: pkgconfig(eigen3) pkgconfig(vcglib)
89BuildRequires: freeglut-devel
90Requires: rcs
91Requires: gedit
92Requires: ImageMagick
93Requires: aqsis-core
94Requires: bitstream-vera-sans-fonts
95Requires: xorg-x11-fonts-misc
96Recommends: vim
97Recommends: lxterminal
98Recommends: kolourpaint
99Recommends: audacity
100
101%description
102The white_dune program is a graphical X3D/VRML97 editor, 
103simple extrusion/NURBS/Superformula 3D modeler and animation tool.
104With white_dune you can create/change 3D objects and animate them (in a easy 
105way if you choose the -4kids GUI). The result can be shown in any WebGL enabled 
106web browser or can be converted to the RIB format for movie creation. 
107X3D and VRML97 are the ISO standard for displaying 3D data over the web. 
108With Cobweb or X3DOM it can displayed in any WebGL enabled web browser. 
109
110Under Linux, white_dune support some 3D input-devices like joysticks, game-pads
111or all devices supported via the Xinput protocol.
112White_dune support quad-buffer stereo visuals. Under Linux, this can be used
113with Elsa Revelator, Crystal Eyes or Nvidia 3D Vision shutter-glasses and 
114special drivers for expensive graphic-cards like Nvidia Quadro or ATI FireGL 4.
115
116%package devel
117License: BSD and MIT
118Summary: Develop files for white_dune
119Requires: %{name}%{?_isa} = %{version}-%{release}
120Requires: freeglut%{?_isa}
121%description devel
122Develop files for white_dune
123
124%package opengl-examples
125License: BSD and MIT
126Summary: Compiled OpenGL examples for white_dune
127Requires: %{name}%{?_isa} = %{version}-%{release}
128Requires: freeglut%{?_isa}
129%description opengl-examples
130Compiled OpenGL examples for white_dune
131
132%package docs
133License: GPLv2+ and BSD and MIT
134BuildArch: noarch
135Summary: Documentation for white_dune
136Requires: %{name}%{?_isa} = %{version}-%{release}
137%description docs
138Documentation for white_dune
139
140%prep
141%setup -q -n "wdune-%{version}"
142
143%build
144%configure \
145    --with-about="white_dune-%{version}" \\
146    --with-optimization \\
147    --without-devil \\
148    --without-ffmpeg \\
149    --with-helpurl="%{_docdir}/wdune-docs/docs/" \\
150    --with-protobaseurl="%{_docdir}/wdune-docs/docs" \\
151    --with-checkincommand="ci" \\
152    --with-x11-editor="gedit" \\
153    --with-imageeditor="kolourpaint" \\
154    --with-imageeditor4kids="kolourpaint" \\
155    --with-cgalheaders \\
156    --with-soundeditor=audacity
157%make_build 
158pushd docs/export_example_c++/opengl_example
159make render_with_picture_path
160popd
161pushd warbird
162make warbird_with_picture_path
163popd
164
165%install
166mkdir -p $RPM_BUILD_ROOT/%{_bindir}
167mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
168mkdir -p $RPM_BUILD_ROOT/%{_includedir}/white_dune
169mkdir -p $RPM_BUILD_ROOT/%{_datadir}/white_dune/opengl_example
170mkdir -p $RPM_BUILD_ROOT/%{_datadir}/applications
171mkdir -p $RPM_BUILD_ROOT/%{_datadir}/pixmaps/
172
173install -m 755 -p bin/dune $RPM_BUILD_ROOT/%{_bindir}/dune
174install -m 755 -p bin/dune4kids $RPM_BUILD_ROOT/%{_bindir}/dune4kids
175install -m 755 -p tools/run_dune_and_aqsis.sh $RPM_BUILD_ROOT/usr/bin/run_dune_and_aqsis.sh
176install -m 755 -p bin/illegal2vrml $RPM_BUILD_ROOT/%{_bindir}/illegal2vrml
177install -m 644 -p desktop/kde/dune.desktop $RPM_BUILD_ROOT/%{_datadir}/applications/dune.desktop
178install -m 644 -p desktop/kde/dune.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps/dune.png
179install -m 644 -p desktop/kde/dune4kids.desktop $RPM_BUILD_ROOT/%{_datadir}/applications/dune4kids.desktop
180install -m 644 -p desktop/kde/dune4kids.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps/dune4kids.png
181install -m 644 -p man/dune.1 $RPM_BUILD_ROOT/%{_mandir}/man1/dune.1
182install -m 644 -p man/dune4kids.1 $RPM_BUILD_ROOT/%{_mandir}/man1/dune4kids.1
183install -m 644 -p man/illegal2vrml.1 $RPM_BUILD_ROOT/%{_mandir}/man1/illegal2vrml.1
184install -m 644 -p include/white_dune/libC++RWD.h $RPM_BUILD_ROOT/%{_includedir}/white_dune/libC++RWD.h
185install -m 644 -p include/white_dune/libCRWD.h $RPM_BUILD_ROOT/%{_includedir}/white_dune/libCRWD.h
186install -m 644 -p include/white_dune/libC++RWD_namespace.h $RPM_BUILD_ROOT/%{_includedir}/white_dune/libC++RWD_namespace.h
187install -m 755 -p warbird/warbird_with_picture_path $RPM_BUILD_ROOT/%{_bindir}/warbird
188install -m 644 -p warbird/warbird.desktop $RPM_BUILD_ROOT/%{_datadir}/applications/warbird.desktop
189install -m 644 -p warbird/warbird.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps/warbird.png
190install -m 755 -p docs/export_example_c++/opengl_example/render_with_picture_path $RPM_BUILD_ROOT/%{_bindir}/white_dune_opengl_example
191install -m 644 -p warbird/cake.png $RPM_BUILD_ROOT/%{_datadir}/white_dune/opengl_example/cake.png
192install -m 644 -p warbird/bill.jpg $RPM_BUILD_ROOT/%{_datadir}/white_dune/opengl_example/bill.jpg
193# remove binary from noarch package
194rm docs/export_example_c++/opengl_example/render_with_picture_path 
195# remove big C++ file from opengl-examples package (can be restored using white_dune)
196rm docs/export_example_c++/opengl_example/C++Export.cc
197cp -r docs/export_example_c++/opengl_example/* $RPM_BUILD_ROOT/%{_datadir}/white_dune/opengl_example
198
199desktop-file-install                                    \\
200--add-category="Graphics"                               \\
201--delete-original                                       \\
202--dir=$RPM_BUILD_ROOT/%{_datadir}/applications          \\
203$RPM_BUILD_ROOT/%{_datadir}/applications/dune.desktop
204desktop-file-install                                    \\
205--add-category="Graphics"                               \\
206--delete-original                                       \\
207--dir=$RPM_BUILD_ROOT/%{_datadir}/applications          \\
208$RPM_BUILD_ROOT/%{_datadir}/applications/dune4kids.desktop
209
210%files
211%license COPYING
212%{_bindir}/dune
213%{_bindir}/dune4kids
214%{_bindir}/run_dune_and_aqsis.sh
215%{_bindir}/illegal2vrml
216%{_datadir}/applications/dune.desktop
217%{_datadir}/pixmaps/dune.png
218%{_datadir}/applications/dune4kids.desktop
219%{_datadir}/pixmaps/dune4kids.png
220%{_mandir}/man1/dune.1*
221%{_mandir}/man1/dune4kids.1*
222%{_mandir}/man1/illegal2vrml.1*
223
224%files devel
225%{_includedir}/white_dune/libC++RWD.h
226%{_includedir}/white_dune/libCRWD.h
227%{_includedir}/white_dune/libC++RWD_namespace.h
228
229%files opengl-examples
230%{_bindir}/warbird
231%{_datadir}/applications/warbird.desktop
232%{_datadir}/pixmaps/warbird.png
233%dir %{_datadir}/white_dune/
234%dir %{_datadir}/white_dune/opengl_example/
235%{_bindir}/white_dune_opengl_example
236%{_datadir}/white_dune/opengl_example/fin.png
237%{_datadir}/white_dune/opengl_example/fire.png
238%{_datadir}/white_dune/opengl_example/Makefile
239%{_datadir}/white_dune/opengl_example/README.txt
240%{_datadir}/white_dune/opengl_example/README_fedora.txt
241%{_datadir}/white_dune/opengl_example/main.cpp
242%{_datadir}/white_dune/opengl_example/robot.x3dv
243%{_datadir}/white_dune/opengl_example/cake.png
244%{_datadir}/white_dune/opengl_example/bill.jpg
245
246%files docs
247%license COPYING
248%doc README.txt docs
249
250%changelog
251
252EOT
253
254rpmdev-bumpspec --comment="Initial RPM release" --userstring="J. Scheurich <mufti11@web.de>" /tmp/wdune.spec
255
256if rpm -ba /tmp/wdune.spec ; then
257   echo > /dev/null
258else
259   rpmbuild -ba /tmp/wdune.spec
260fi
261
262
263
264