about summary refs log blame commit diff stats
path: root/core/ports.html
blob: 7f1cd54abd0b51bc5465a5de975a1ffe646deba9 (plain) (tree)
div class='alt'>
103











                                              


                                                              









                                                                 
 


                                                                            

             
                                                         

              

                                                                           





                                     


                                                                    














                                                                                          
                                                                           

              

                                                  
                                                                                                                



                                                                               

                                                                                   

             



                                                 
                                                  

                                   
                                















                                                                       
                                                                        
                                 
                                               
                                  
                                               
                                    
                                              









                                     

              








                                                                                        

                                                     
                                      

             





                                                                  

                                 
                                  
                              


                                                                         



                                                                      
                                                                           

                                       
 


                                               
                        



                                                     

                                                                            
 


                                                                         
                                     
                                                             
 
                                                  
                                      
 


                                       

                                                                        


                                            
                              
 
                                
                                                        


                                    

              

                                              

                                                      
                



                                                                                            
<!DOCTYPE html>
<html dir="ltr" lang="en">
    <head>
        <meta charset='utf-8'>
        <title>1.3. Ports</title>
    </head>
    <body>

        <a href="index.html">Core OS Index</a>

        <h1>1.3. Ports</h1>

        <p>This instructions are done
        <a href="configure.html#chroot">inside chroot</a>.</p>

        <h2 id="filesystem">1.3.1. Ports Layout</h2>

	<p>Make sure follow directories exist;</p>

	<pre>
	#  mkdir /usr/ports
	#  mkdir -p /usr/ports/{distfiles,packages,work,pkgbuild}
	</pre>

        <h2 id="fakeroot">1.3.2. Build as user</h2>

        <p>For more information read
	<a href="https://crux.nu/Wiki/FakerootPorts">Fakeroot Ports</a>.
	Add a user that will be used by ports tools, this example pkgmk;</p>

        <pre>
        # useradd -U -M -d /usr/ports -s /bin/false pkgmk
        </pre>

        <p>You can add your self to group pkgmk. Check if members of this
        group are under <a href="linux.html#sysctl">tpe</a> protection.</p>

        <pre>
        # usermod -a -G pkgmk c9admin
        </pre>

        <pre>
	#  chown pkgmk /usr/ports/{distfiles,packages,work,pkgbuild}
	#  chown pkgmk:pkgmk /usr/ports/pkgbuild
	#  chmod g+w /usr/ports/pkgbuild
        </pre>

        <p>Configure to
        <a href="https://crux.nu/Wiki/HowToSpeedUpBuildingPackages#ram">compile in ram</a>
        average of 3GB is recommended for core while firefox need at least 30G.
	Discover id of pkgmk user;</p>

        <pre>
        # id pkgmk
        uid=102(pkgmk) gid=102(pkgmk) groups=102(pkgmk)
        </pre>

        <p>Edit fstab, change uid to id of pkgmk, this example 102;</p>

        <pre>
        pkgmk /usr/ports/work tmpfs size=30G,uid=102,defaults,mode=0750 0 0
        </pre>

        <h2 id="pkgmk">1.3.3. Configure pkgmk</h2>

        <p>Read <a href="https://crux.nu/Handbook3-3#ntoc22">4.5. Adjust/Configure the Package Build Process</a>
        to take advantage of your specific hardware. Packages build with
        native flag will not run on different hardware. This is the best choice
        if you want gcc to find the best settings based on your hardware.</p>

        <p>Edit /etc/pkgmk.conf, remove pipe from compiler flags and let the system
        get from nproc how many cpu's it can use for compiling;</p>

        <pre>
        #
        # /etc/pkgmk.conf: pkgmk(8) configuration
        #

        export CFLAGS="-O2 -g -march=x86-64 -pipe"
        export CXXFLAGS="${CFLAGS}"

        # export MAKEFLAGS="-j2"

        case ${PKGMK_ARCH} in
                "64"|"")
                        ;;
                "32")
                        export CFLAGS="${CFLAGS} -m32"
                        export CXXFLAGS="${CXXFLAGS} -m32"
                        export LDFLAGS="${LDFLAGS} -m32"
                        export PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig"
                        ;;
                *)
                        echo "Unknown architecture selected! Exiting."
                        exit 1
                        ;;
        esac

        #PKGMK_SOURCE_MIRRORS=(http://hive.gnu.systems/ports/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_DOWNLOAD="no"
        # PKGMK_IGNORE_FOOTPRINT="no"
        # PKGMK_IGNORE_NEW="no"
        # PKGMK_NO_STRIP="no"
        # PKGMK_DOWNLOAD_PROG="wget"
        # PKGMK_WGET_OPTS=""
        # PKGMK_CURL_OPTS=""
        # PKGMK_COMPRESSION_MODE="gz"

        # End of file
        </pre>

        <p>If you want native build change the above example to;</p>

        <pre>
        export CFLAGS="-O2 -march=native -mtune=native"
        </pre>

        <p>Check <a href="toolchain.html">toolchain</a> for more options on how packages
        are build.</p>

        <h2 id="prtget">1.3.4. Configure prt-get</h2>

        <p>Edit /etc/prt-get.conf;</p>

        <pre>
        ###
        ### prt-get conf
        ###

        # note: the order matters: the package found first is used
        prtdir /usr/ports/core
        prtdir /usr/ports/opt
        prtdir /usr/ports/contrib
        prtdir /usr/ports/c9-ports
        prtdir /usr/ports/xorg

        # 6c37 team provides a collection with freetype-iu, fontconfig-iu
        # and cairo-iu ports.

        # the following line enables the multilib compat-32 collection
        #prtdir /usr/ports/compat-32

        # the following line enables the user maintained contrib collection
        # prtdir /usr/ports/6c37-dropin
        # prtdir /usr/ports/6c37

        ### 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)
        logfile  /usr/ports/pkgbuild/%n-%v-%r.log
                                   # path, %p=path to port dir, %n=port name
                                   #       %v=version, %r=release

        ### use alternate cache file (default: /var/lib/pkg/prt-get.cache
        # cachefile /mnt/nfs/cache

        ### print readme information:
        readme verbose           # (verbose|compact|disabled)

        ### prefer higher versions in sysup / diff
        preferhigher no     # (yes|no)

        ### use regexp search
        # useregex no        # (yes|no)

        ### run pre- and post-installs scripts; yes is equivalent to the
        ### --install-scripts option
        runscripts yes            # (no|yes)


        ### expert section ###

        ### alternative commands
        makecommand      sudo -h -u pkgmk fakeroot pkgmk
        addcommand       sudo pkgadd
        removecommand    sudo pkgrm
        runscriptcommand sudo sh
        </pre>

        <a href="index.html">Core OS Index</a>
        <p>
        This is part of the Hive System Documentation.
        Copyright (C) 2018
        c9 team.
        See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
        for copying conditions.</p>
    </body>
</html>