+FORTIFY_SOURCE feature provides primitive support for detecting buffer overflows in various functions which operates on memory areas and strings. A limited set of buffer overflows can be detected with this feature, but it provides an additional level of validation for some functions which are potentially an origin of buffer overflow flaws.
+if ( "`sysctl -n security.bsd.hardlink_check_uid`" == "1" ) then
+ echo "build will fail, due to hard security checks"
+ echo "sysctl security.bsd.hardlink_check_uid=0"
+ exit
+endif
+
+if ( "`sysctl -n security.bsd.hardlink_check_gid`" == "1" ) then
+ echo "build will fail, due to hard security checks"
+ echo "sysctl security.bsd.hardlink_check_gid=0"
+ exit
+endif
+
+if ( (${_current_dir} != "hardenedBSD.git")) then
+ if ((${_current_dir} != "opBSD.git")) then
+ set _current_dir = "hardenedBSD.git"
+ endif
+endif
+
+echo "build source dir: ${_current_dir}"
+sleep 1
+
+if ( ! -d $MAKEOBJDIRPREFIX ) then
+ mkdir $MAKEOBJDIRPREFIX
+endif
+
+ln -sf ${_log} ${_log_last}
+
+(cd /usr/data/source/git/opBSD/${_current_dir}; make -j$__freebsd_mk_jobs -DNO_CLEAN -DNO_ROOT KERNCONF=GENERIC buildworld buildkernel) |& tee -a ${_log}
+if ( "`sysctl -n security.bsd.hardlink_check_uid`" == "1" ) then
+ echo "build will fail, due to hard security checks"
+ echo "sysctl security.bsd.hardlink_check_uid=0"
+ exit
+endif
+
+if ( "`sysctl -n security.bsd.hardlink_check_gid`" == "1" ) then
+ echo "build will fail, due to hard security checks"
+ echo "sysctl security.bsd.hardlink_check_gid=0"
+ exit
+endif
+
+if ( (${_current_dir} != "hardenedBSD.git")) then
+ if ((${_current_dir} != "opBSD.git")) then
+ set _current_dir = "hardenedBSD.git"
+ endif
+endif
+
+echo "build source dir: ${_current_dir}"
+sleep 1
+
+if ( ! -d $MAKEOBJDIRPREFIX ) then
+ mkdir $MAKEOBJDIRPREFIX
+endif
+
+ln -sf ${_log} ${_log_last}
+
+(cd /usr/data/source/git/opBSD/${_current_dir}; make -j$__freebsd_mk_jobs -DNO_CLEAN -DNO_ROOT KERNCONF=GENERIC installworld installkernel) |& tee -a ${_log}