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