gtk2.spec 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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.6.7
  26. %define V_gtk_major 2.6
  27. %define V_glib_major 2.6
  28. %define V_pango_major 1.8
  29. %define V_atk_major 1.9
  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: 20050419
  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
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. BuildPreReq: X11, png, jpeg, tiff, gettext, pango, pkgconfig >= 0.14.0, make
  50. PreReq: X11, png, jpeg, tiff, gettext, pango, pkgconfig >= 0.14.0
  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. # and force pkg-config to provide static libs
  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. -e 's;\(PKG_CONFIG.*--libs\);\1 --static;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. Makefile.in \
  106. */Makefile.in \
  107. */*/Makefile.in
  108. %{l_shtool} subst \
  109. -e 's;/gtk-2\.0;/gtk2;g' \
  110. -e 's;-l\(g[-_a-z]*\)-@GTK_API_VERSION@;-l\12;g' \
  111. -e 's;-l\(g[-_a-z]*\)-\${target}-@GTK_API_VERSION@;-l\12;g' \
  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. # correct unnecessary and flawed dependency
  125. %{l_shtool} subst \
  126. -e 's;[a-zA-Z0-9$()-_/.]*libgdk_pixbuf-2.0.la *;;' \
  127. modules/engines/pixbuf/Makefile.in
  128. %build
  129. # set x11 paths
  130. xinc=`%{l_rc} --query x11_incdir`
  131. xlib=`%{l_rc} --query x11_libdir`
  132. # configure package
  133. CC="%{l_cc}" \
  134. CFLAGS="%{l_cflags -O}" \
  135. CPPFLAGS="%{l_cppflags tiff} -I$xinc" \
  136. LDFLAGS="%{l_ldflags}" \
  137. ./configure \
  138. --prefix=%{l_prefix} \
  139. --with-x \
  140. --x-includes=$xinc \
  141. --x-libraries=$xlib \
  142. --with-glib-prefix=%{l_prefix} \
  143. --with-libpng=%{l_prefix} \
  144. --with-libjpeg=%{l_prefix} \
  145. --with-libtiff=%{l_prefix} \
  146. --disable-modules \
  147. --with-included-loaders=yes \
  148. --enable-nls \
  149. --with-native-locale=no \
  150. --enable-shm \
  151. --disable-debug \
  152. --disable-rebuilds \
  153. --enable-shared \
  154. --enable-static
  155. # create a libtool for building without shared libs
  156. cp -fp libtool libtool_noshared
  157. %{l_shtool} subst \
  158. -e 's;\(build_libtool_libs\)=yes;\1=no;g' \
  159. libtool_noshared
  160. # build libgtk-x11-2.0, libgdk_pixbuf2, and libgdk-x11-2.0 only statically
  161. %{l_shtool} subst \
  162. -e 's;^LIBTOOL = \(.*\)libtool;LIBTOOL = \1libtool_noshared;' \
  163. gdk-pixbuf/Makefile.in \
  164. gdk-pixbuf/Makefile \
  165. gdk/Makefile.in \
  166. gdk/Makefile \
  167. gtk/Makefile.in \
  168. gtk/Makefile
  169. # build package
  170. %{l_make} %{l_mflags}
  171. %install
  172. # install package
  173. rm -rf $RPM_BUILD_ROOT
  174. %{l_shtool} mkdir -f -p -m 755 \
  175. $RPM_BUILD_ROOT%{l_prefix}/etc/gtk2
  176. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  177. # provide config file
  178. %{l_shtool} install -c -m 644 \
  179. /dev/null \
  180. $RPM_BUILD_ROOT%{l_prefix}/etc/gtk2/gtk.immodules
  181. # use generic library name
  182. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libgtk-x11-2.0.a \
  183. $RPM_BUILD_ROOT%{l_prefix}/lib/libgtk2.a
  184. mv $RPM_BUILD_ROOT%{l_prefix}/lib/libgdk-x11-2.0.a \
  185. $RPM_BUILD_ROOT%{l_prefix}/lib/libgdk2.a
  186. # clean up installation area
  187. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  188. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/themes
  189. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/gtk2
  190. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
  191. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/locale
  192. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol]
  193. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].*
  194. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
  195. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/gtk2/immodules/*
  196. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-[0-9][0-9.]*
  197. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1
  198. # determine installation files
  199. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  200. %{l_files_std} \
  201. '%not %dir %{l_prefix}/share/aclocal' \
  202. '%not %dir %{l_prefix}/lib/pkgconfig'
  203. %files -f files
  204. %clean
  205. rm -rf $RPM_BUILD_ROOT