pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   schmonz
Date:           Mon Nov  5 19:26:38 UTC 2018

Modified Files:
        pkgsrc/bootstrap: bootstrap
        pkgsrc/mk/platform: SunOS.mk

Log Message:
Optionally detect whether the compiler supports "-fstack-protector-strong".
If not, set _OPSYS_SUPPORTS_SSP=no during bootstrap and in mk.conf.

Do SSP detection on "SunOS", and let mk/platform/SunOS.mk's default
"yes" be overridden in mk.conf.

No change to generated mk.conf on NetBSD 8 or CentOS 6. Fixes bootstrap
on Tribblix.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 pkgsrc/bootstrap/bootstrap
cvs rdiff -u -r1.77 -r1.78 pkgsrc/mk/platform/SunOS.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/bootstrap/bootstrap
diff -u pkgsrc/bootstrap/bootstrap:1.256 pkgsrc/bootstrap/bootstrap:1.257
--- pkgsrc/bootstrap/bootstrap:1.256    Tue Oct 30 15:22:53 2018
+++ pkgsrc/bootstrap/bootstrap  Mon Nov  5 19:26:38 2018
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: bootstrap,v 1.256 2018/10/30 15:22:53 sevan Exp $
+# $NetBSD: bootstrap,v 1.257 2018/11/05 19:26:38 schmonz Exp $
 #
 # Copyright (c) 2001-2011 Alistair Crooks <agc%NetBSD.org@localhost>
 # All rights reserved.
@@ -841,6 +841,7 @@ SunOS)
        whoamiprog="${idprog} -un"
        machine_arch=`uname -p | sed -e 's/i86pc/i386/'`
        check_compiler=yes
+       check_ssp=yes
        ;;
 UnixWare)
        root_group=sys
@@ -991,6 +992,27 @@ if [ "$compiler" = "" ] && [ x"$check_co
        fi
 fi
 
+has_ssp_support() {
+       _compiler=cc
+       if [ "$compiler" != "" ]; then
+               _compiler="$compiler"
+       fi
+
+       mkdir_p_early ${wrkdir}/tmp
+       echo 'int main(void){return 0;}' > ${wrkdir}/tmp/ssp.c
+       ${_compiler} -fstack-protector-strong -o ${wrkdir}/tmp/ssp ${wrkdir}/tmp/ssp.c >/dev/null 2>&1
+
+       if [ $? -eq 0 ]; then
+               echo yes
+       else
+               echo no
+       fi
+}
+
+if [ "$has_ssp" = "" ] && [ x"$check_ssp" = x"yes" ]; then
+       has_ssp=`has_ssp_support`
+fi
+
 mkdir_p_early ${wrkdir}/bin
 
 # build install-sh
@@ -1025,6 +1047,9 @@ fi
 PKG_DBDIR=$pkgdbdir; export PKG_DBDIR
 LOCALBASE=$prefix; export LOCALBASE
 VARBASE=$varbase; export VARBASE
+if [ x"$has_ssp" = x"no" ] && [ x"$check_ssp" = x"yes" ]; then
+_OPSYS_SUPPORTS_SSP=no; export _OPSYS_SUPPORTS_SSP
+fi
 
 # set up an example mk.conf file
 TARGET_MKCONF=${wrkdir}/mk.conf.example
@@ -1072,6 +1097,10 @@ if [ -n "$SUNWSPROBASE" ]; then
 fi
 echo "" >> ${TARGET_MKCONF}
 
+if [ x"$has_ssp" = x"no" ] && [ x"$check_ssp" = x"yes" ]; then
+       echo "_OPSYS_SUPPORTS_SSP=      no" >> ${TARGET_MKCONF}
+fi
+
 # enable unprivileged builds if not root
 if [ "$unprivileged" = "yes" ]; then
        echo "UNPRIVILEGED=             yes" >> ${TARGET_MKCONF}

Index: pkgsrc/mk/platform/SunOS.mk
diff -u pkgsrc/mk/platform/SunOS.mk:1.77 pkgsrc/mk/platform/SunOS.mk:1.78
--- pkgsrc/mk/platform/SunOS.mk:1.77    Tue Oct 10 13:57:23 2017
+++ pkgsrc/mk/platform/SunOS.mk Mon Nov  5 19:26:38 2018
@@ -1,4 +1,4 @@
-# $NetBSD: SunOS.mk,v 1.77 2017/10/10 13:57:23 jperkin Exp $
+# $NetBSD: SunOS.mk,v 1.78 2018/11/05 19:26:38 schmonz Exp $
 #
 # Variable definitions for the SunOS/Solaris operating system.
 
@@ -131,7 +131,7 @@ _OPSYS_SUPPORTS_CWRAPPERS=  yes
 _OPSYS_SUPPORTS_FORTIFY=yes
 
 # support stack protection (with GCC)
-_OPSYS_SUPPORTS_SSP=   yes
+_OPSYS_SUPPORTS_SSP?=  yes
 
 _OPSYS_CAN_CHECK_SHLIBS=       yes # requires readelf
 



Home | Main Index | Thread Index | Old Index