gtk2.spec 7.8 KB

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