gtk2.spec 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. ##
  2. ## gtk2.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package version
  25. %define V_gtk 2.8.6
  26. %define V_gtk_major 2.8
  27. %define V_glib_major 2.8
  28. %define V_pango_major 1.10
  29. %define V_atk_major 1.10
  30. # package information
  31. Name: gtk2
  32. Summary: The Gtk Toolkit Library (%{V_gtk_major})
  33. URL: http://www.gtk.org/
  34. Vendor: The Gtk Project
  35. Packager: OpenPKG
  36. Distribution: OpenPKG
  37. Class: PLUS
  38. Group: XWindow
  39. License: GPL
  40. Version: %{V_gtk}
  41. Release: 20051006
  42. # list of sources
  43. Source0: ftp://ftp.gtk.org/pub/gtk/v%{V_gtk_major}/gtk+-%{V_gtk}.tar.gz
  44. Patch0: gtk2.patch
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20040130, make, pkgconfig
  49. PreReq: OpenPKG, openpkg >= 20040130
  50. BuildPreReq: X11, png, jpeg, tiff, gettext
  51. PreReq: X11, png, jpeg, tiff, gettext
  52. BuildPreReq: glib2 >= %{V_glib_major}, pango >= %{V_pango_major}, atk >= %{V_atk_major}
  53. PreReq: glib2 >= %{V_glib_major}, pango >= %{V_pango_major}, atk >= %{V_atk_major}
  54. AutoReq: no
  55. AutoReqProv: no
  56. %description
  57. Gtk+ is a multi-platform toolkit for creating graphical user
  58. interfaces. Offering a complete set of widgets, Gtk+ is suitable for
  59. projects ranging from small one-off projects to complete application
  60. suites.
  61. %track
  62. prog gtk2 = {
  63. version = %{version}
  64. url = ftp://ftp.gtk.org/pub/gtk/
  65. regex = (v2\.[2468])
  66. url = ftp://ftp.gtk.org/pub/gtk/__NEWVER__/
  67. regex = gtk\+-(__VER__)\.tar\.(gz|bz2)
  68. }
  69. %prep
  70. %setup -q -n gtk+-%{version}
  71. %patch -p0
  72. # avoid including static libraries into convenience libraries
  73. %{l_shtool} subst \
  74. -e 's;^LIBS =.*;LIBS =;' \
  75. gdk-pixbuf/Makefile.in \
  76. gdk-pixbuf/pixops/Makefile.in \
  77. gtk/xdgmime/Makefile.in \
  78. gdk/x11/Makefile.in
  79. # avoid searching for shared libraries
  80. %{l_shtool} subst \
  81. -e 's;echo eval echo \\\$export_dynamic_flag_spec;;g' \
  82. -e 's;^\(LIBS="-lintl\)\ *\($LIBS"\);\1 -liconv \2;g' \
  83. configure
  84. # build binaries from static libraries
  85. %{l_shtool} subst \
  86. -e 's;\(gtk_demo_LDFLAGS *=\);\1 -static;' \
  87. demos/gtk-demo/Makefile.in
  88. %{l_shtool} subst \
  89. -e 's;\(gtk_query_immodules_2_0_LDFLAGS *=\);\1 -static;' \
  90. -e 's;^\(gtk_query_immodules_2_0_LDADD *=.*\);\1 -lpangoft2;' \
  91. gtk/Makefile.in
  92. %{l_shtool} subst \
  93. -e 's;\(gdk_pixbuf_csource_LDFLAGS *=\);\1 -static;' \
  94. -e 's;\(gdk_pixbuf_csource_LDADD .*\);\1 -lintl;' \
  95. -e 's;\(gdk_pixbuf_query_loaders_LDFLAGS *=\);\1 -static;' \
  96. -e 's;\(gdk_pixbuf_query_loaders_LDADD .*\);\1 -lintl;' \
  97. gdk-pixbuf/Makefile.in
  98. # remove version from paths
  99. %{l_shtool} subst \
  100. -e 's;/gtk-2\.0;/gtk2;g' \
  101. -e 's;lib\(g[-_a-z]*\)-2\.0;lib\12;g' \
  102. -e 's;/@PACKAGE@;;g' \
  103. -e 's;-\$(GTK_API_VERSION);2;g' \
  104. -e 's;/\$(GTK_BINARY_VERSION);;g' \
  105. `find . -name Makefile.in -print`
  106. %{l_shtool} subst \
  107. -e 's;/gtk-2\.0;/gtk2;g' \
  108. -e 's;-l\(g[-_a-z]*\)-@GTK_API_VERSION@;-l\12;g' \
  109. -e 's;-l\(g[-_a-z]*\)-\${target}-@GTK_API_VERSION@;-l\12;g' \
  110. -e 's;\(@GDK_EXTRA_LIBS@\);@X_LIBS@ \1;' \
  111. -e 's;\(@GDK_EXTRA_CFLAGS@\);@X_CFLAGS@ \1;' \
  112. *-2.0.pc.in
  113. %{l_shtool} subst \
  114. -e 's;gtk-2.0;gtk2;g' \
  115. gtk/gtkrc.c
  116. # adjust path to locale and doc files
  117. %{l_shtool} subst \
  118. -e 's;\${libdir}/locale;\${datadir}/locale;' \
  119. -e 's;/gtk-doc/html;/gtk2/html;g' \
  120. configure
  121. %{l_shtool} subst \
  122. -e 's;\$(libdir)/locale;\$(datadir)/locale;' \
  123. po/Makefile.in.in
  124. %build
  125. # set x11 paths
  126. xinc=`%{l_rc} --query x11_incdir`
  127. xlib=`%{l_rc} --query x11_libdir`
  128. # configure package
  129. CC="%{l_cc}" \
  130. CFLAGS="%{l_cflags -O}" \
  131. CPPFLAGS="%{l_cppflags tiff} -I$xinc" \
  132. LDFLAGS="%{l_ldflags}" \
  133. ./configure \
  134. --prefix=%{l_prefix} \
  135. --with-x \
  136. --x-includes=$xinc \
  137. --x-libraries=$xlib \
  138. --with-glib-prefix=%{l_prefix} \
  139. --with-libpng=%{l_prefix} \
  140. --with-libjpeg=%{l_prefix} \
  141. --with-libtiff=%{l_prefix} \
  142. --disable-modules \
  143. --with-included-loaders=yes \
  144. --enable-nls \
  145. --with-native-locale=no \
  146. --enable-shm \
  147. --disable-debug \
  148. --disable-rebuilds \
  149. --enable-shared \
  150. --enable-static
  151. # create a libtool for building without shared libs
  152. cp -fp libtool libtool_noshared
  153. %{l_shtool} subst \
  154. -e 's;\(build_libtool_libs\)=yes;\1=no;g' \
  155. libtool_noshared
  156. # build libgtk-x11-2.0, libgdk_pixbuf2, and libgdk-x11-2.0 only statically
  157. %{l_shtool} subst \
  158. -e 's;^LIBTOOL = \(.*\)libtool;LIBTOOL = \1libtool_noshared;' \
  159. gdk-pixbuf/Makefile.in \
  160. gdk-pixbuf/Makefile \
  161. gdk/Makefile.in \
  162. gdk/Makefile \
  163. gtk/Makefile.in \
  164. gtk/Makefile
  165. # build package
  166. %{l_make} %{l_mflags}
  167. %install
  168. # install package
  169. rm -rf $RPM_BUILD_ROOT
  170. %{l_shtool} mkdir -f -p -m 755 \
  171. $RPM_BUILD_ROOT%{l_prefix}/etc/gtk2
  172. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  173. # provide config file
  174. %{l_shtool} install -c -m 644 \
  175. /dev/null \
  176. $RPM_BUILD_ROOT%{l_prefix}/etc/gtk2/gtk.immodules
  177. # use generic library name
  178. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libgtk-x11-2.0.a \
  179. $RPM_BUILD_ROOT%{l_prefix}/lib/libgtk2.a
  180. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libgdk-x11-2.0.a \
  181. $RPM_BUILD_ROOT%{l_prefix}/lib/libgdk2.a
  182. # clean up installation area
  183. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  184. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/themes
  185. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/gtk2
  186. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
  187. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/locale
  188. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol]
  189. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].*
  190. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  191. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/engines/*.a
  192. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/engines/*.la
  193. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/immodules/*.a
  194. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/immodules/*.la
  195. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-[0-9][0-9.]*
  196. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1
  197. # determine installation files
  198. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  199. %{l_files_std} \
  200. '%not %dir %{l_prefix}/share/aclocal' \
  201. '%not %dir %{l_prefix}/lib/pkgconfig'
  202. %files -f files
  203. %clean
  204. rm -rf $RPM_BUILD_ROOT