gtk2.spec 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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.4
  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: 20050929
  42. # list of sources
  43. Source0: ftp://ftp.gtk.org/pub/gtk/v%{V_gtk_major}/gtk+-%{V_gtk}.tar.gz
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, make, pkgconfig
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. BuildPreReq: X11, png, jpeg, tiff, gettext
  50. PreReq: X11, png, jpeg, tiff, gettext
  51. BuildPreReq: glib2 >= %{V_glib_major}, pango >= %{V_pango_major}, atk >= %{V_atk_major}
  52. PreReq: glib2 >= %{V_glib_major}, pango >= %{V_pango_major}, atk >= %{V_atk_major}
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. Gtk+ is a multi-platform toolkit for creating graphical user
  57. interfaces. Offering a complete set of widgets, Gtk+ is suitable for
  58. projects ranging from small one-off projects to complete application
  59. suites.
  60. %track
  61. prog gtk2 = {
  62. version = %{version}
  63. url = ftp://ftp.gtk.org/pub/gtk/
  64. regex = (v2\.[2468])
  65. url = ftp://ftp.gtk.org/pub/gtk/__NEWVER__/
  66. regex = gtk\+-(__VER__)\.tar\.(gz|bz2)
  67. }
  68. %prep
  69. %setup -q -n gtk+-%{version}
  70. # avoid including static libraries into convenience libraries
  71. %{l_shtool} subst \
  72. -e 's;^LIBS =.*;LIBS =;' \
  73. gdk-pixbuf/Makefile.in \
  74. gdk-pixbuf/pixops/Makefile.in \
  75. gtk/xdgmime/Makefile.in \
  76. gdk/x11/Makefile.in
  77. # avoid searching for shared libraries
  78. %{l_shtool} subst \
  79. -e 's;echo eval echo \\\$export_dynamic_flag_spec;;g' \
  80. -e 's;^\(LIBS="-lintl\)\ *\($LIBS"\);\1 -liconv \2;g' \
  81. configure
  82. # build binaries from static libraries
  83. %{l_shtool} subst \
  84. -e 's;\(gtk_demo_LDFLAGS *=\);\1 -static;' \
  85. demos/gtk-demo/Makefile.in
  86. %{l_shtool} subst \
  87. -e 's;\(gtk_query_immodules_2_0_LDFLAGS *=\);\1 -static;' \
  88. -e 's;^\(gtk_query_immodules_2_0_LDADD *=.*\);\1 -lpangoft2;' \
  89. gtk/Makefile.in
  90. %{l_shtool} subst \
  91. -e 's;\(gdk_pixbuf_csource_LDFLAGS *=\);\1 -static;' \
  92. -e 's;\(gdk_pixbuf_csource_LDADD .*\);\1 -lintl;' \
  93. -e 's;\(gdk_pixbuf_query_loaders_LDFLAGS *=\);\1 -static;' \
  94. -e 's;\(gdk_pixbuf_query_loaders_LDADD .*\);\1 -lintl;' \
  95. gdk-pixbuf/Makefile.in
  96. # remove version from paths
  97. %{l_shtool} subst \
  98. -e 's;/gtk-2\.0;/gtk2;g' \
  99. -e 's;lib\(g[-_a-z]*\)-2\.0;lib\12;g' \
  100. -e 's;/@PACKAGE@;;g' \
  101. -e 's;-\$(GTK_API_VERSION);2;g' \
  102. -e 's;/\$(GTK_BINARY_VERSION);;g' \
  103. `find . -name Makefile.in -print`
  104. %{l_shtool} subst \
  105. -e 's;/gtk-2\.0;/gtk2;g' \
  106. -e 's;-l\(g[-_a-z]*\)-@GTK_API_VERSION@;-l\12;g' \
  107. -e 's;-l\(g[-_a-z]*\)-\${target}-@GTK_API_VERSION@;-l\12;g' \
  108. -e 's;\(@GDK_EXTRA_LIBS@\);@X_LIBS@ \1;' \
  109. -e 's;\(@GDK_EXTRA_CFLAGS@\);@X_CFLAGS@ \1;' \
  110. *-2.0.pc.in
  111. %{l_shtool} subst \
  112. -e 's;gtk-2.0;gtk2;g' \
  113. gtk/gtkrc.c
  114. # adjust path to locale and doc files
  115. %{l_shtool} subst \
  116. -e 's;\${libdir}/locale;\${datadir}/locale;' \
  117. -e 's;/gtk-doc/html;/gtk2/html;g' \
  118. configure
  119. %{l_shtool} subst \
  120. -e 's;\$(libdir)/locale;\$(datadir)/locale;' \
  121. po/Makefile.in.in
  122. %build
  123. # set x11 paths
  124. xinc=`%{l_rc} --query x11_incdir`
  125. xlib=`%{l_rc} --query x11_libdir`
  126. # configure package
  127. CC="%{l_cc}" \
  128. CFLAGS="%{l_cflags -O}" \
  129. CPPFLAGS="%{l_cppflags tiff} -I$xinc" \
  130. LDFLAGS="%{l_ldflags}" \
  131. ./configure \
  132. --prefix=%{l_prefix} \
  133. --with-x \
  134. --x-includes=$xinc \
  135. --x-libraries=$xlib \
  136. --with-glib-prefix=%{l_prefix} \
  137. --with-libpng=%{l_prefix} \
  138. --with-libjpeg=%{l_prefix} \
  139. --with-libtiff=%{l_prefix} \
  140. --disable-modules \
  141. --with-included-loaders=yes \
  142. --enable-nls \
  143. --with-native-locale=no \
  144. --enable-shm \
  145. --disable-debug \
  146. --disable-rebuilds \
  147. --enable-shared \
  148. --enable-static
  149. # create a libtool for building without shared libs
  150. cp -fp libtool libtool_noshared
  151. %{l_shtool} subst \
  152. -e 's;\(build_libtool_libs\)=yes;\1=no;g' \
  153. libtool_noshared
  154. # build libgtk-x11-2.0, libgdk_pixbuf2, and libgdk-x11-2.0 only statically
  155. %{l_shtool} subst \
  156. -e 's;^LIBTOOL = \(.*\)libtool;LIBTOOL = \1libtool_noshared;' \
  157. gdk-pixbuf/Makefile.in \
  158. gdk-pixbuf/Makefile \
  159. gdk/Makefile.in \
  160. gdk/Makefile \
  161. gtk/Makefile.in \
  162. gtk/Makefile
  163. # build package
  164. %{l_make} %{l_mflags}
  165. %install
  166. # install package
  167. rm -rf $RPM_BUILD_ROOT
  168. %{l_shtool} mkdir -f -p -m 755 \
  169. $RPM_BUILD_ROOT%{l_prefix}/etc/gtk2
  170. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  171. # provide config file
  172. %{l_shtool} install -c -m 644 \
  173. /dev/null \
  174. $RPM_BUILD_ROOT%{l_prefix}/etc/gtk2/gtk.immodules
  175. # use generic library name
  176. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libgtk-x11-2.0.a \
  177. $RPM_BUILD_ROOT%{l_prefix}/lib/libgtk2.a
  178. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libgdk-x11-2.0.a \
  179. $RPM_BUILD_ROOT%{l_prefix}/lib/libgdk2.a
  180. # clean up installation area
  181. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  182. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/themes
  183. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/gtk2
  184. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
  185. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/locale
  186. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol]
  187. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].*
  188. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  189. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/engines/*.a
  190. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/engines/*.la
  191. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/immodules/*.a
  192. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/immodules/*.la
  193. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-[0-9][0-9.]*
  194. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1
  195. # determine installation files
  196. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  197. %{l_files_std} \
  198. '%not %dir %{l_prefix}/share/aclocal' \
  199. '%not %dir %{l_prefix}/lib/pkgconfig'
  200. %files -f files
  201. %clean
  202. rm -rf $RPM_BUILD_ROOT