# HG changeset patch # User Michael Schloh von Bennewitz # Date 1347037687 -7200 # Node ID 9dacbd1d1aa27408926fd0fe8bbbfd16300468f6 # Parent 0c12a9c824a06cf1ed7a473be9000826ab27149e 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. diff -r 0c12a9c824a0 -r 9dacbd1d1aa2 tun/tun.patch --- a/tun/tun.patch Fri Sep 07 19:01:31 2012 +0200 +++ b/tun/tun.patch Fri Sep 07 19:08:07 2012 +0200 @@ -1,3 +1,14 @@ +Index: solaris/configure +--- solaris/configure.orig 2000-05-04 21:24:53.000000000 +0200 ++++ solaris/configure 2012-09-07 01:25:49.313354333 +0200 +@@ -769,6 +769,7 @@ + s%@oldincludedir@%$oldincludedir%g + s%@infodir@%$infodir%g + s%@mandir@%$mandir%g ++s%@CC@%$CC%g + s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g + s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g + s%@INSTALL_DATA@%$INSTALL_DATA%g Index: linux/2.2/tun.c --- linux/2.2/tun.c.orig 2006-10-10 14:45:00.338589000 +0200 +++ linux/2.2/tun.c 2006-10-10 14:44:05.695404000 +0200 diff -r 0c12a9c824a0 -r 9dacbd1d1aa2 tun/tun.spec --- a/tun/tun.spec Fri Sep 07 19:01:31 2012 +0200 +++ b/tun/tun.spec Fri Sep 07 19:08:07 2012 +0200 @@ -21,10 +21,6 @@ ## SUCH DAMAGE. ## -# MSvB Fixme: Device driver could possibly be stripped -# %{l_shtool} install -c -m -s 755 \ -# tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun - # package information Name: tun Summary: Universal TUN/TAP Device Driver @@ -48,7 +44,7 @@ %description Tun provides packet reception and transmission for user space - programs. It can be viewed as a simple Point-to-Point device, which + programs. It can be viewed as a simple point to point device, which instead of receiving packets from a physical media, receives them from user space program and instead of sending packets via physical media writes them to the user space program. @@ -63,6 +59,20 @@ %prep %setup -q -n tun-%{version} %patch -p0 + %{l_shtool} subst \ + -e 's;^\(CC *= *\).*;\1@CC@;' \ + -e 's;^\(CFLAGS *= *\).*;\1@CFLAGS@ $(DEFS) -D_KERNEL -I.;' \ + solaris/Makefile.in + case "%{l_platform -t}" in + *-sunos5.1[01] ) + %{l_shtool} subst \ + -e 's;"tun";"vtun";g' \ + solaris/tun.c + %{l_shtool} subst \ + -e 's;tun;vtun;g' \ + solaris/tun.conf + ;; + esac case "%{l_platform -t}" in *-sunos5.11 ) %{l_shtool} subst \ @@ -71,10 +81,25 @@ solaris/tun.c ;; esac + case "%{l_platform -t}" in + *64-* ) + %{l_shtool} subst \ +%if "%{l_cc}" == "/opt/solarisstudio12.3/bin/cc" + -e 's;\(\$(LD)\) *\(.*-o tun\);\1 -64 \2;' \ + -e 's;^\(CFLAGS *=.*\);\1 -fast -xO4 -m64 -Kpic;' \ +%else + -e 's;^\(CFLAGS *=.*\);\1 -O2 -m64 -fPIC;' \ +%endif + solaris/Makefile.in + ;; + esac %build +%if "%{l_cc}" == "/opt/solarisstudio12.3/bin/cc" + PATH="/bin:/sbin:/usr/bin:/usr/sbin:/opt/solarisstudio12.3/bin" +%endif CC="%{l_cc}" \ - CFLAGS="%{l_cflags -O}" \ + CFLAGS="%{l_cflags}" \ ./configure \ --prefix=%{l_prefix} locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'` @@ -87,8 +112,22 @@ $RPM_BUILD_ROOT%{l_prefix}/lib/tun locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'` ( cd $locplat - %{l_shtool} install -c -m 644 \ - tun tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun + case "%{l_platform -t}" in + *-sunos5.1[01] ) + %{l_shtool} install -c -m 755 \ + tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun/vtun + %{l_shtool} install -c -m 644 \ + tun.conf $RPM_BUILD_ROOT%{l_prefix}/lib/tun/vtun.conf + %{l_shtool} install -c -m 644 \ + if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun/ + ;; + * ) + %{l_shtool} install -c -m 755 \ + tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun + %{l_shtool} install -c -m 644 \ + tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun + ;; + esac ) || exit $? %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} @@ -110,11 +149,16 @@ echo "" echo " $ su -" echo " # find %{l_prefix}/lib/tun/ -print" - echo " # shtool install -c -m 755 -o root -g sys tun /usr/kernel/drv/" - echo " # shtool install -c -m 644 -o root -g sys tun.conf /usr/kernel/drv/" - echo " # shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/" - echo " # /usr/sbin/rem_drv tun" - echo " # /usr/sbin/add_drv tun" + echo " # shtool install -c -m 644 -o root -g sys (v)tun.conf /usr/kernel/drv/" + echo " # (optional) shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/" + echo " # file (v)tun # if the driver 32-bit or 64-bit is very important" + echo " # (either) shtool install -c -m 755 -o root -g sys (v)tun /usr/kernel/drv/" + echo " # (or) shtool install -c -m 755 -o root -g sys (v)tun /usr/kernel/drv/amd64/" + echo " # (or) shtool install -c -m 755 -o root -g sys (v)tun /usr/kernel/drv/sparcv9/" + echo " # modinfo | grep tun" + echo " # /usr/sbin/rem_drv -C (v)tun" + echo " # /usr/sbin/add_drv (v)tun" + echo " # modinfo | grep tun" ) | %{l_rpmtool} msg -b -t notice fi exit 0 @@ -127,12 +171,15 @@ echo "from system areas outside of the OpenPKG instance." echo "" echo " $ su -" - echo " # ls -ld /usr/kernel/drv/*tun* /usr/include/net/*tun*" - echo " # /usr/sbin/rem_drv tun" + echo " # ls -ld /usr/kernel/drv/*/*tun* /usr/kernel/drv/*tun* /usr/include/net/*tun*" + echo " # modinfo | grep tun" + echo " # /usr/sbin/rem_drv -C (v)tun" + echo " # modinfo | grep tun" echo " # ls -ld /usr/kernel/drv/*tun*" + echo " # ls -ld /usr/kernel/drv/*/*tun*" echo " # ls -ld /usr/include/net/*tun*" - echo " # rm -f /usr/kernel/drv/tun" - echo " # rm -f /usr/kernel/drv/tun.conf" + echo " # rm -f /usr/kernel/drv/[archpath]/(v)tun" + echo " # rm -f /usr/kernel/drv/(v)tun.conf" echo " # rm -f /usr/include/net/if_tun.h" ) | %{l_rpmtool} msg -b -t notice exit 0