Просмотр исходного кода

make package more flexible with new with_cxx and with_optimize options

Ralf S. Engelschall 24 лет назад
Родитель
Сommit
74015dd4cc
1 измененных файлов с 36 добавлено и 8 удалено
  1. 36 8
      gcc/gcc.spec

+ 36 - 8
gcc/gcc.spec

@@ -23,13 +23,22 @@
 ##  SUCH DAMAGE.
 ##
 
+#   package versions
 %define       V_major 3.1
 %define       V_short 3.1
 %define       V_long  3.1
 
+#   package options
+%ifndef       with_cxx
+%define       with_cxx       yes
+%endif
+%ifndef       with_optimize
+%define       with_optimize  yes
+%endif
+
 #   package information
 Name:         gcc
-Summary:      GNU C/C++ Compiler
+Summary:      GNU Compiler Collection
 URL:          http://gcc.gnu.org/
 Vendor:       Free Software Foundation
 Packager:     The OpenPKG Project
@@ -37,7 +46,7 @@ Distribution: OpenPKG [REL]
 Group:        Language
 License:      GPL
 Version:      %{V_short}
-Release:      20020605
+Release:      20020628
 
 #   list of sources
 Source0:      ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{V_long}/gcc-%{V_long}.tar.bz2
@@ -54,6 +63,8 @@ AutoReqProv:  no
     The GNU Compiler Collection (GCC) provides a standard conforming and
     highly portable ISO C and ISO C++ compiler.
 
+    Options: with_cxx=%{with_cxx} with_optimize=%{with_optimize}
+
 %prep
     %setup -q -n gcc-%{V_long}
     %{l_shtool} subst -v -s \
@@ -76,7 +87,11 @@ AutoReqProv:  no
         --includedir=%{l_prefix}/include/gcc \
         --with-gxx-include-dir=%{l_prefix}/include/g++ \
         --with-local-prefix=%{l_prefix}/lib/gcc-lib \
+%if "%{with_cxx}" == "yes"
         --enable-languages="c,c++" \
+%else
+        --enable-languages="c" \
+%endif
         --enable-threads \
         --disable-maintainer-mode \
         --disable-shared \
@@ -84,6 +99,7 @@ AutoReqProv:  no
         $options
 
     #   build the package
+%if "%{with_optimize}" == "yes"
     l_boot_cflags="-O2"
     l_cflags="-O"
     l_libcflags="-g -O2"
@@ -91,6 +107,12 @@ AutoReqProv:  no
     case "%{l_target}" in
        *-osf* ) l_boot_cflags="-O" ;;
     esac
+%else
+    l_boot_cflags=""
+    l_cflags=""
+    l_libcflags="-g"
+    l_libcxxflags="-g -fno-implicit-templates"
+%endif
     %{l_make} %{l_mflags} \
         MAKE="%{l_make} %{l_mflags}" \
         BOOT_CFLAGS="$l_boot_cflags" \
@@ -143,10 +165,12 @@ AutoReqProv:  no
     mv $RPM_BUILD_ROOT%{l_prefix}/$triple/include/* \
        $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/include/ >/dev/null 2>&1 || true
     rm -rf $RPM_BUILD_ROOT%{l_prefix}/$triple
-    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la
-    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc
-    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++
-    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.la  >/dev/null 2>&1 || true
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-gcc >/dev/null 2>&1 || true
+%if "%{with_cxx}" == "yes"
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-c++ >/dev/null 2>&1 || true
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*-g++ >/dev/null 2>&1 || true
+%endif
     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
     for prog in cc1 cc1plus collect2 cpp; do
         strip $RPM_BUILD_ROOT%{l_prefix}/lib/gcc-lib/$triple/%{V_major}/$prog >/dev/null 2>&1 || true
@@ -154,8 +178,12 @@ AutoReqProv:  no
 
     #   make additional links
     ln $RPM_BUILD_ROOT%{l_prefix}/bin/gcc $RPM_BUILD_ROOT%{l_prefix}/bin/cc
-    ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
-    ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
+    ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/gcc.1 \
+       $RPM_BUILD_ROOT%{l_prefix}/man/man1/cc.1
+%if "%{with_cxx}" == "yes"
+    ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/g++.1 \
+       $RPM_BUILD_ROOT%{l_prefix}/man/man1/c++.1
+%endif
 
     #   create file list
     %{l_rpmtool} files -v -o$RPM_BUILD_DIR/gcc-%{V_long}/files -r$RPM_BUILD_ROOT %{l_files_std}