From 5adacc390c152b1540372d653712cb41fcb76b7b Mon Sep 17 00:00:00 2001 From: Silvino Date: Tue, 11 Jun 2019 00:27:06 +0100 Subject: ports distcc and ccache revision --- core/conf/pkgmk.conf | 26 +++++++++++++++++++----- core/conf/rc.d/distccd | 33 ++++++++++++++++++++++++++++++ core/ports.html | 55 ++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 103 insertions(+), 11 deletions(-) create mode 100755 core/conf/rc.d/distccd diff --git a/core/conf/pkgmk.conf b/core/conf/pkgmk.conf index 18d8730..c94fea7 100644 --- a/core/conf/pkgmk.conf +++ b/core/conf/pkgmk.conf @@ -2,12 +2,20 @@ # /etc/pkgmk.conf: pkgmk(8) configuration # -export CFLAGS="-O2 -march=x86-64" +export CFLAGS="-O2 -g -march=x86-64" export CXXFLAGS="${CFLAGS}" +# local compile only export JOBS=$(nproc) export MAKEFLAGS="-j $JOBS" +## compile using distcc +## set static cpu cores available +###export MAKEFLAGS="-j 8" +## get dynamically cpu cores available +#export MAKEFLAGS="/usr/bin/distcc -j 2> /dev/null" +#export SCONSFLAGS="$MAKEFLAGS" + case ${PKGMK_ARCH} in "64"|"") ;; @@ -23,16 +31,14 @@ case ${PKGMK_ARCH} in ;; esac -PKGMK_SOURCE_MIRRORS=(https://hive.gnu.systems/mirror/distfiles/) +PKGMK_SOURCE_MIRRORS=(http://c1.ank/distfiles/ http://c1.ank/archive/distfiles/) # PKGMK_SOURCE_DIR="$PWD" PKGMK_SOURCE_DIR="/usr/ports/distfiles" # PKGMK_PACKAGE_DIR="$PWD" PKGMK_PACKAGE_DIR="/usr/ports/packages" # PKGMK_WORK_DIR="$PWD/work" -PKGMK_WORK_DIR="/usr/ports/work/${name}" +PKGMK_WORK_DIR="/usr/ports/work/$name" # PKGMK_DOWNLOAD="no" -# PKGMK_IGNORE_SIGNATURE="no" -# PKGMK_IGNORE_MD5SUM="no" # PKGMK_IGNORE_FOOTPRINT="no" # PKGMK_IGNORE_NEW="no" # PKGMK_NO_STRIP="no" @@ -40,5 +46,15 @@ PKGMK_WORK_DIR="/usr/ports/work/${name}" # PKGMK_WGET_OPTS="" # PKGMK_CURL_OPTS="" # PKGMK_COMPRESSION_MODE="gz" +# PKGMK_UP_TO_DATE=yes + +## ccache settings +#export PATH="/usr/lib/ccache/:$PATH" +#export CCACHE_DIR="/usr/ports/cache/ccache" +#export CCACHE_PREFIX="distcc" +#export CCACHE_COMPILERCHECK="%compiler% -dumpversion; crux" +# +#export DISTCC_HOSTS="localhost/4 worker/4" +#export DISTCC_DIR="/urs/ports/distcc" # End of file diff --git a/core/conf/rc.d/distccd b/core/conf/rc.d/distccd new file mode 100755 index 0000000..65a166d --- /dev/null +++ b/core/conf/rc.d/distccd @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# /etc/rc.d/distccd: start/stop distcc daemon +# + +. /etc/distcc.conf +if [ -z "$DISTCC_ALLOW" ]; then + echo "Please define a range of IPs allowed to connect to this distccd" + echo "host in DISTCC_ALLOW in /etc/rc.conf. More detailed information" + echo "can be found in the distcc's README package." + exit 1 +fi + +DISTCC_USER="${DISTCC_USER:=nobody}" +DISTCC_LOG_LEVEL="${DISTCC_LOG_LEVEL:=notice}" + +case $1 in +start) + /usr/sbin/distccd --daemon --user "$DISTCC_USER" --allow "$DISTCC_ALLOW" --log-level "$DISTCC_LOG_LEVEL" + ;; +stop) + killall -q /usr/sbin/distccd + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/core/ports.html b/core/ports.html index 07d52d2..a61643d 100644 --- a/core/ports.html +++ b/core/ports.html @@ -148,15 +148,15 @@ prtdir /usr/ports/contrib prtdir /usr/ports/ports prtdir /usr/ports/mate - prtdir /usr/ports/kde + prtdir /usr/ports/kde5 ### use mypackage form local directory # prtdir /home/packages/build:mypackage ### log options: - # writelog enabled # (enabled|disabled) - # logmode overwrite # (append|overwrite) - # rmlog_on_success yes # (no|yes) + writelog enabled # (enabled|disabled) + logmode overwrite # (append|overwrite) + rmlog_on_success yes # (no|yes) logfile /var/log/pkgbuild/%n.log # path, %p=path to port dir, %n=port name # %v=version, %r=release @@ -198,14 +198,57 @@ $ prt-get depinst ccache distcc -

Add to /etc/profile;

+

Configure pkgmk and define number of cores available, + in this example get dynamically Edit /etc/pkgmk.conf;

+        ## local compile only
+        #export JOBS=$(nproc)
+        #export MAKEFLAGS="-j $JOBS"
+
+        # compile using distcc
+        # set static cpu cores available
+        ##export MAKEFLAGS="-j 8"
+        # get dynamically cpu cores available
+        export MAKEFLAGS="/usr/bin/distcc -j 2> /dev/null"
+        export SCONSFLAGS="$MAKEFLAGS"
+        
+ +

Set ccaching directory and instructs to use distcc backend;

+ +
+        # ccache settings
         export PATH="/usr/lib/ccache/:$PATH"
-        export CCACHE_DIR="/var/cache/ccache"
+        export CCACHE_DIR="/usr/ports/cache/ccache"
+        export CCACHE_PREFIX="distcc"
         export CCACHE_COMPILERCHECK="%compiler% -dumpversion; crux"
         
+

Set distcc hosts and respective number of cpu cores to send work;

+
+        export DISTCC_HOSTS="localhost/4 worker/4"
+        export DISTCC_DIR="/urs/ports/distcc"
+        
+ +

Configure distcc daemon, edit /etc/rc.d/distccd;

+ +
+        #!/usr/bin/env bash
+        #
+        # /etc/rc.d/distccd: start/stop distcc daemon
+        #
+
+        . /etc/distcc.conf
+        if [ -z "$DISTCC_ALLOW" ]; then 
+        
+ +

Create /etc/distcc.conf;

+ +
+
+        
+ + Core OS Index

This is part of the Hive System Documentation. -- cgit 1.4.1-2-gfad0