gcc43.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. ##
  2. ## gcc43.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 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. # FIXME: rse: unconditionally requires gmp/mpfr!?
  25. # FIXME: rse: with_cxx still broken
  26. # package version
  27. %define V_full 4.3
  28. %define V_comp 43
  29. %define V_snap 20070504
  30. # package information
  31. Name: gcc43
  32. Summary: GNU Compiler Collection
  33. URL: http://gcc.gnu.org/
  34. Vendor: Free Software Foundation
  35. Packager: OpenPKG Foundation e.V.
  36. Distribution: OpenPKG Community
  37. Class: EVAL
  38. Group: Compiler
  39. License: GPL
  40. Version: %{V_full}s%{V_snap}
  41. Release: 20070505
  42. # package options
  43. %option with_cxx no
  44. %option with_objc no
  45. %option with_java no
  46. %option with_fortran no
  47. %option with_optimize yes
  48. %option with_profile no
  49. %option with_binutils yes
  50. %option with_threads yes
  51. %option with_multilib no
  52. %option with_gcc no
  53. # list of sources
  54. Source0: ftp://gcc.gnu.org/pub/gcc/snapshots/%{V_full}-%{V_snap}/gcc-%{V_full}-%{V_snap}.tar.bz2
  55. Patch0: gcc43.patch
  56. # build information
  57. Prefix: %{l_prefix}
  58. BuildRoot: %{l_buildroot}
  59. BuildPreReq: OpenPKG, openpkg >= 20060622, make, flex, bison, texinfo
  60. PreReq: OpenPKG, openpkg >= 20060622
  61. %if "%{with_binutils}" == "yes"
  62. BuildPreReq: binutils >= 2.14
  63. PreReq: binutils >= 2.14
  64. %endif
  65. # %if "%{with_fortran}" == "yes"
  66. BuildPreReq: mpfr, gmp
  67. PreReq: mpfr, gmp
  68. # %endif
  69. %if "%{with_java}" == "yes"
  70. BuildPreReq: zlib
  71. PreReq: zlib
  72. %endif
  73. AutoReq: no
  74. AutoReqProv: no
  75. %if "%{with_gcc}" == "yes"
  76. Provides: gcc = %{version}-%{release}
  77. %endif
  78. %description
  79. The GNU Compiler Collection (GCC) provides a standard conforming and
  80. highly portable ISO C and ISO C++ compiler.
  81. %track
  82. prog gcc43 = {
  83. version = %{V_full}-%{V_snap}
  84. url = ftp://gcc.gnu.org/pub/gcc/snapshots/
  85. regex = (%{V_full}-\d{8})
  86. url = ftp://gcc.gnu.org/pub/gcc/snapshots/__NEWVER__/
  87. regex = gcc-(\d+\.\d+-\d{8})\.tar\.bz2
  88. }
  89. %prep
  90. %setup -q -n gcc-%{V_full}-%{V_snap}
  91. %patch -p0
  92. %{l_shtool} subst -v -s \
  93. -e 's;PREFIX_INCLUDE_DIR;PREFIX_INCLUDE_DIR_DISABLED;g' \
  94. gcc/configure
  95. %{l_shtool} subst -v -s \
  96. -e 's;\(VERSUFFIX "\)\("\);\1 (%{l_openpkg_release -F "OpenPKG-%%t"})\2;' \
  97. -e 's;\(bug_report_url\[\] = "\)[^"]*;\1<URL:http://www.openpkg.org/>;' \
  98. gcc/version.c
  99. if [ ".%{V_comp}" != . ]; then
  100. %{l_shtool} subst -v -s \
  101. -e 's;(libdir)/gcc/;(libdir)/gcc%{V_comp}/;' \
  102. `find . -name Makefile.in -type f -print`
  103. fi
  104. case "%{l_platform -t}" in
  105. amd64*-linux* )
  106. %{l_shtool} subst \
  107. -e 's/GLIBCXX_IS_NATIVE=false/GLIBCXX_IS_NATIVE=true/g' \
  108. -e 's/test x.gcc_no_link = xyes/false/g' \
  109. libstdc++-v3/configure
  110. ;;
  111. esac
  112. %build
  113. # create build sub-directory
  114. mkdir obj
  115. cd obj
  116. # determine ld(1) and as(1) usage
  117. l_with_gnu_ld_as=""
  118. %if "%{with_binutils}" == "yes"
  119. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
  120. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
  121. %else
  122. case "%{l_platform -t}" in
  123. *-linux* | *-freebsd* )
  124. l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
  125. ;;
  126. esac
  127. %endif
  128. # determine threads usage
  129. %if "%{with_threads}" == "yes"
  130. l_enable_threads="posix"
  131. %else
  132. l_enable_threads="single"
  133. %endif
  134. # override threads setting for platforms with known limitations
  135. case "%{l_platform -t}" in
  136. *-netbsd1.6* ) l_enable_threads="single" ;;
  137. esac
  138. # determine language usage
  139. l_enable_languages="c"
  140. %if "%{with_cxx}" == "yes"
  141. l_enable_languages="${l_enable_languages},c++"
  142. %endif
  143. %if "%{with_objc}" == "yes"
  144. l_enable_languages="${l_enable_languages},objc"
  145. %endif
  146. %if "%{with_java}" == "yes"
  147. l_enable_languages="${l_enable_languages},java"
  148. %endif
  149. %if "%{with_fortran}" == "yes"
  150. l_enable_languages="${l_enable_languages},f95"
  151. %endif
  152. # disable GNU iconv usage
  153. ( echo "am_cv_func_iconv=no"
  154. echo "am_cv_lib_iconv=no"
  155. ) >config.cache
  156. # configure the package
  157. CC="%{l_cc}" \
  158. CFLAGS="%{l_cflags}" \
  159. %if "%{with_java}" == "yes" || "%{with_fortran}" == "yes"
  160. CPPFLAGS="%{l_cppflags}" \
  161. LDFLAGS="%{l_ldflags}" \
  162. %endif
  163. CONFIG_SHELL="%{l_bash}" \
  164. ../configure \
  165. --cache-file=./config.cache \
  166. --srcdir=`pwd`/.. \
  167. --prefix=%{l_prefix} \
  168. --exec-prefix=%{l_prefix} \
  169. --includedir=%{l_prefix}/include/gcc%{V_comp} \
  170. --libexecdir=%{l_prefix}/libexec/gcc%{V_comp} \
  171. --with-gxx-include-dir=%{l_prefix}/include/g++%{V_comp} \
  172. --with-local-prefix=%{l_prefix}/lib/gcc%{V_comp} \
  173. --enable-languages="${l_enable_languages}" \
  174. --enable-threads="${l_enable_threads}" \
  175. --disable-maintainer-mode \
  176. --disable-shared \
  177. --disable-nls \
  178. %if "%{with_java}" == "yes"
  179. --with-system-zlib \
  180. %endif
  181. %if "%{with_multilib}" == "yes"
  182. --enable-multilib \
  183. %else
  184. --disable-multilib \
  185. %endif
  186. --with-gmp=%{l_prefix} \
  187. --with-mpfr=%{l_prefix} \
  188. ${l_with_gnu_ld_as}
  189. # determine build flags
  190. l_ccisgcc=no
  191. if [ ".`(%{l_cc} -v; %{l_cc} --version) </dev/null 2>&1 | grep -i 'gcc'`" != . ]; then
  192. l_ccisgcc=yes
  193. fi
  194. l_cflags=""
  195. l_boot_cflags=""
  196. l_libcflags="-g"
  197. l_libcxxflags="-g"
  198. case "%{l_platform -t}" in
  199. alpha*-tru64* ) if [ ".$l_ccisgcc" = .no ]; then l_libcflags="$l_libcflags -ieee"; fi ;;
  200. esac
  201. %if "%{with_binutils}" == "yes"
  202. # at least GNU as from GNU binutils supports -pipe always
  203. l_boot_cflags="$l_boot_cflags -pipe"
  204. l_libcxxflags="$l_libcxxflags -pipe"
  205. %endif
  206. %if "%{with_optimize}" == "yes"
  207. # conservatively optimize the generated program code
  208. # (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)
  209. l_cflags="$l_cflags -O"
  210. l_boot_cflags="$l_boot_cflags -O2 -fomit-frame-pointer"
  211. case "%{l_platform -t}" in
  212. *i?86-* ) l_boot_cflags="$l_boot_cflags -mtune=pentium3" ;;
  213. *sun4[uv]-* ) l_boot_cflags="$l_boot_cflags -mtune=v9" ;;
  214. esac
  215. l_libcxxflags="$l_libcxxflags -O2 -fno-implicit-templates"
  216. %else
  217. # else do no optimizations at all to reduce problems to minimum in advance
  218. l_boot_cflags="$l_boot_cflags -O0"
  219. l_libcxxflags="$l_libcxxflags -O0"
  220. %endif
  221. maketarget="bootstrap-lean"
  222. %if "%{with_profile}" == "yes"
  223. # GCC >= 3.4 supports a "profiledbootstrap" target to build an
  224. # optimized version of itself through profiling. Because this
  225. # requires a (bootstrapping) C compiler with 64-bit arithmetic,
  226. # the whole approach is currently supported only if already
  227. # building with GCC as the bootstrapping C compiler.
  228. if [ ".$l_ccisgcc" = .yes ]; then
  229. maketarget="profiledbootstrap"
  230. fi
  231. %endif
  232. # build the package
  233. %{l_make} %{l_mflags} \
  234. MAKE="%{l_make} %{l_mflags}" \
  235. BOOT_CFLAGS="${l_boot_cflags}" \
  236. CFLAGS="${l_cflags}" \
  237. LIBCFLAGS="${l_libcflags}" \
  238. LIBCXXFLAGS="${l_libcxxflags}" \
  239. $maketarget
  240. %install
  241. rm -rf $RPM_BUILD_ROOT
  242. # fetch GNU platform triple
  243. triple=`./config.guess`
  244. # perform the standard installation procedure
  245. ( cd obj
  246. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  247. ) || exit $?
  248. # cleanup installation tree
  249. mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
  250. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/
  251. dirs=""
  252. for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
  253. subdir=`echo "$multilib" | sed -e 's/;.*$//'`
  254. [ ".$subdir" = .. ] && continue
  255. mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
  256. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/$subdir/
  257. dirs="$dirs $subdir"
  258. done
  259. for subdir in $dirs; do
  260. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir
  261. done
  262. mv $RPM_BUILD_ROOT%{l_prefix}/${triple}/include/* \
  263. $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/include/ \
  264. >/dev/null 2>&1 || true
  265. # strip installation tree
  266. rm -rf $RPM_BUILD_ROOT%{l_prefix}/${triple}
  267. rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
  268. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man7 >/dev/null 2>&1 || true
  269. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la >/dev/null 2>&1 || true
  270. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc* >/dev/null 2>&1 || true
  271. %if "%{with_cxx}" == "yes"
  272. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
  273. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
  274. %endif
  275. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  276. for prog in cc1 cc1plus collect2 cpp; do
  277. strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}/${triple}/[0-9]*/${prog} \
  278. >/dev/null 2>&1 || true
  279. done
  280. # bump up installation tree
  281. ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc \
  282. $RPM_BUILD_ROOT%{l_prefix}/bin/cc
  283. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
  284. $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
  285. %if "%{with_cxx}" == "yes"
  286. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
  287. $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
  288. %endif
  289. # resolve filename conflicts
  290. %if "%{with_gcc}" != "yes" && "%{V_comp}" != ""
  291. ( cd $RPM_BUILD_ROOT%{l_prefix}/bin
  292. for file in *; do
  293. [ ".$file" = ".*" ] && continue
  294. mv ${file} ${file}%{V_comp}
  295. done
  296. ) || exit $?
  297. ( cd $RPM_BUILD_ROOT%{l_prefix}/info
  298. for file in *; do
  299. [ ".$file" = ".*" ] && continue
  300. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  301. done
  302. ) || exit $?
  303. ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man1
  304. for file in *; do
  305. [ ".$file" = ".*" ] && continue
  306. mv ${file} `echo ${file} | sed -e 's;^\([^.]*\)\(\..*\)$;\1%{V_comp}\2;'`
  307. done
  308. ) || exit $?
  309. %endif
  310. # determine installation file list
  311. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  312. %files -f files
  313. %clean
  314. rm -rf $RPM_BUILD_ROOT