Correct build configuration in Solaris subdir, correct english grammar,

Fri, 07 Sep 2012 19:08:07 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 07 Sep 2012 19:08:07 +0200
changeset 667
9dacbd1d1aa2
parent 666
0c12a9c824a0
child 668
4b4e887677a9

Correct build configuration in Solaris subdir, correct english grammar,
remove irrelevant strip notice, introduce custom CFLAG logic, facilitate
use of Solaris Studio compiler with needed build configuration
adjustments, conditionally build 64 bit position independent code,
and accommodate tun(7) in newer Solaris releases by renaming driver
and module from conflicting 'tun' to 'vtun'. These changes include
some nonstandard 'I give up' logic causing out of tree builds by
manipulating the PATH, for example.

tun/tun.patch file | annotate | diff | comparison | revisions
tun/tun.spec file | annotate | diff | comparison | revisions
     1.1 --- a/tun/tun.patch	Fri Sep 07 19:01:31 2012 +0200
     1.2 +++ b/tun/tun.patch	Fri Sep 07 19:08:07 2012 +0200
     1.3 @@ -1,3 +1,14 @@
     1.4 +Index: solaris/configure
     1.5 +--- solaris/configure.orig	2000-05-04 21:24:53.000000000 +0200
     1.6 ++++ solaris/configure	2012-09-07 01:25:49.313354333 +0200
     1.7 +@@ -769,6 +769,7 @@
     1.8 + s%@oldincludedir@%$oldincludedir%g
     1.9 + s%@infodir@%$infodir%g
    1.10 + s%@mandir@%$mandir%g
    1.11 ++s%@CC@%$CC%g
    1.12 + s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
    1.13 + s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
    1.14 + s%@INSTALL_DATA@%$INSTALL_DATA%g
    1.15  Index: linux/2.2/tun.c
    1.16  --- linux/2.2/tun.c.orig	2006-10-10 14:45:00.338589000 +0200
    1.17  +++ linux/2.2/tun.c	2006-10-10 14:44:05.695404000 +0200
     2.1 --- a/tun/tun.spec	Fri Sep 07 19:01:31 2012 +0200
     2.2 +++ b/tun/tun.spec	Fri Sep 07 19:08:07 2012 +0200
     2.3 @@ -21,10 +21,6 @@
     2.4  ##  SUCH DAMAGE.
     2.5  ##
     2.6  
     2.7 -# MSvB Fixme: Device driver could possibly be stripped
     2.8 -#    %{l_shtool} install -c -m -s 755 \
     2.9 -#        tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    2.10 -
    2.11  #   package information
    2.12  Name:         tun
    2.13  Summary:      Universal TUN/TAP Device Driver
    2.14 @@ -48,7 +44,7 @@
    2.15  
    2.16  %description
    2.17      Tun provides packet reception and transmission for user space       
    2.18 -    programs. It can be viewed as a simple Point-to-Point device, which 
    2.19 +    programs. It can be viewed as a simple point to point device, which 
    2.20      instead of receiving packets from a physical media, receives them   
    2.21      from user space program and instead of sending packets via physical 
    2.22      media writes them to the user space program.                        
    2.23 @@ -63,6 +59,20 @@
    2.24  %prep
    2.25      %setup -q -n tun-%{version}
    2.26      %patch -p0
    2.27 +    %{l_shtool} subst \
    2.28 +        -e 's;^\(CC *= *\).*;\1@CC@;' \
    2.29 +        -e 's;^\(CFLAGS *= *\).*;\1@CFLAGS@ $(DEFS) -D_KERNEL -I.;' \
    2.30 +        solaris/Makefile.in
    2.31 +    case "%{l_platform -t}" in
    2.32 +        *-sunos5.1[01] )
    2.33 +            %{l_shtool} subst \
    2.34 +                -e 's;"tun";"vtun";g' \
    2.35 +                solaris/tun.c
    2.36 +            %{l_shtool} subst \
    2.37 +                -e 's;tun;vtun;g' \
    2.38 +                solaris/tun.conf
    2.39 +            ;;
    2.40 +    esac
    2.41      case "%{l_platform -t}" in
    2.42          *-sunos5.11 )
    2.43              %{l_shtool} subst \
    2.44 @@ -71,10 +81,25 @@
    2.45                  solaris/tun.c
    2.46              ;;
    2.47      esac
    2.48 +    case "%{l_platform -t}" in
    2.49 +        *64-* )
    2.50 +            %{l_shtool} subst \
    2.51 +%if "%{l_cc}" == "/opt/solarisstudio12.3/bin/cc"
    2.52 +                -e 's;\(\$(LD)\)  *\(.*-o tun\);\1 -64 \2;' \
    2.53 +                -e 's;^\(CFLAGS *=.*\);\1 -fast -xO4 -m64 -Kpic;' \
    2.54 +%else
    2.55 +                -e 's;^\(CFLAGS *=.*\);\1 -O2 -m64 -fPIC;' \
    2.56 +%endif
    2.57 +                solaris/Makefile.in
    2.58 +            ;;
    2.59 +    esac
    2.60  
    2.61  %build
    2.62 +%if "%{l_cc}" == "/opt/solarisstudio12.3/bin/cc"
    2.63 +    PATH="/bin:/sbin:/usr/bin:/usr/sbin:/opt/solarisstudio12.3/bin"
    2.64 +%endif
    2.65      CC="%{l_cc}" \
    2.66 -    CFLAGS="%{l_cflags -O}" \
    2.67 +    CFLAGS="%{l_cflags}" \
    2.68      ./configure \
    2.69          --prefix=%{l_prefix}
    2.70      locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
    2.71 @@ -87,8 +112,22 @@
    2.72          $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    2.73      locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
    2.74      ( cd $locplat
    2.75 -      %{l_shtool} install -c -m 644 \
    2.76 -          tun tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    2.77 +      case "%{l_platform -t}" in
    2.78 +          *-sunos5.1[01] )
    2.79 +              %{l_shtool} install -c -m 755 \
    2.80 +                  tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun/vtun
    2.81 +              %{l_shtool} install -c -m 644 \
    2.82 +                  tun.conf $RPM_BUILD_ROOT%{l_prefix}/lib/tun/vtun.conf
    2.83 +              %{l_shtool} install -c -m 644 \
    2.84 +                  if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun/
    2.85 +              ;;
    2.86 +          * )
    2.87 +              %{l_shtool} install -c -m 755 \
    2.88 +                  tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    2.89 +              %{l_shtool} install -c -m 644 \
    2.90 +                  tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    2.91 +              ;;
    2.92 +      esac
    2.93      ) || exit $?
    2.94      %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
    2.95  
    2.96 @@ -110,11 +149,16 @@
    2.97            echo ""
    2.98            echo "  $ su -"
    2.99            echo "  # find %{l_prefix}/lib/tun/ -print"
   2.100 -          echo "  # shtool install -c -m 755 -o root -g sys tun /usr/kernel/drv/"
   2.101 -          echo "  # shtool install -c -m 644 -o root -g sys tun.conf /usr/kernel/drv/"
   2.102 -          echo "  # shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/"
   2.103 -          echo "  # /usr/sbin/rem_drv tun"
   2.104 -          echo "  # /usr/sbin/add_drv tun"
   2.105 +          echo "  # shtool install -c -m 644 -o root -g sys (v)tun.conf /usr/kernel/drv/"
   2.106 +          echo "  # (optional) shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/"
   2.107 +          echo "  # file (v)tun  # if the driver 32-bit or 64-bit is very important"
   2.108 +          echo "  # (either) shtool install -c -m 755 -o root -g sys (v)tun /usr/kernel/drv/"
   2.109 +          echo "  # (or) shtool install -c -m 755 -o root -g sys (v)tun /usr/kernel/drv/amd64/"
   2.110 +          echo "  # (or) shtool install -c -m 755 -o root -g sys (v)tun /usr/kernel/drv/sparcv9/"
   2.111 +          echo "  # modinfo | grep tun"
   2.112 +          echo "  # /usr/sbin/rem_drv -C (v)tun"
   2.113 +          echo "  # /usr/sbin/add_drv (v)tun"
   2.114 +          echo "  # modinfo | grep tun"
   2.115          ) | %{l_rpmtool} msg -b -t notice
   2.116      fi
   2.117      exit 0
   2.118 @@ -127,12 +171,15 @@
   2.119        echo "from system areas outside of the OpenPKG instance."
   2.120        echo ""
   2.121        echo "  $ su -"
   2.122 -      echo "  # ls -ld /usr/kernel/drv/*tun* /usr/include/net/*tun*"
   2.123 -      echo "  # /usr/sbin/rem_drv tun"
   2.124 +      echo "  # ls -ld /usr/kernel/drv/*/*tun* /usr/kernel/drv/*tun* /usr/include/net/*tun*"
   2.125 +      echo "  # modinfo | grep tun"
   2.126 +      echo "  # /usr/sbin/rem_drv -C (v)tun"
   2.127 +      echo "  # modinfo | grep tun"
   2.128        echo "  # ls -ld /usr/kernel/drv/*tun*"
   2.129 +      echo "  # ls -ld /usr/kernel/drv/*/*tun*"
   2.130        echo "  # ls -ld /usr/include/net/*tun*"
   2.131 -      echo "  # rm -f /usr/kernel/drv/tun"
   2.132 -      echo "  # rm -f /usr/kernel/drv/tun.conf"
   2.133 +      echo "  # rm -f /usr/kernel/drv/[archpath]/(v)tun"
   2.134 +      echo "  # rm -f /usr/kernel/drv/(v)tun.conf"
   2.135        echo "  # rm -f /usr/include/net/if_tun.h"
   2.136      ) | %{l_rpmtool} msg -b -t notice
   2.137      exit 0

mercurial