SpartanCoin Xjail 90p

mkcmake: How to Install Docs

• Some Related MACROS •

PROJECTNAME

Default PROJECTNAME is the project directory name.

DESTDIR

DESTDIR set the chroot location

Default DESTDIR is empty, which means "no chroot" , so the default DESTDIR will be /

PREFIX

Default PREFIX is /usr/local

DATADIR

Default DATADIR is ${PREFIX}/share, and to notice that the DESTDIR would set the chroot location, so the real DATADIR will be ${DESTDIR}/${PREFIX}/share .

DOCDIR

It seems that mk-configure didn't define DOCDIR, so this is defined by user conveniently.

FILES

The FILES set the doc files list in the current project directory, should be set by user.

FILESDIR

The installing target directory. The default FILESDIR is ${PREFIX}/bin , and to notice that the DESTDIR would set the chroot location, so the default real FILESDIR is ${DESTDIR}/${PREFIX}/bin .

• Install •

1. Command: mkcmake install

2. If FILES is not defined , "mkcmake install" will install PROGS into ${FILESDIR} which is under bin/, and not install your docs .

3. If FILES is defined , but FILESDIR is not defined by user , the PROGS and the docs listed on FILES will be all installed into ${FILESDIR} which is under bin/.

4. If FILES is defined, and FILESDIR is defined by user too, the PROGS will be installed into ${PREFIX}/bin, and the docs listed on ${FILES} will be installed into ${FILESDIR} .

5. Notice that DESTDIR would set the chroot location .

6. Be careful that FILESDIR has some other unmentioned fucking evil devils .

• Example •

step 1: Create Projects

$ mkdir -p tmp/docu
$ cd tmp/docu
$ touch COPYRIGHT README doc.html
$ cd ..
$ vim main.cxx
$ vim Makefile

file: main.cxx

#include <iostream>

int main() {
        std::cout << "mk-configure mkcmake" << std::endl;
}

file: Makefile

print-info:
        @echo "PROJECTNAME: ${PROJECTNAME}"
        @echo "DESTDIR: ${DESTDIR}"
        @echo "PREFIX: ${PREFIX}"
        @echo "DATADIR: ${DATADIR}"
        @echo "DOCDIR: ${DOCDIR}"
        @echo "FILES: ${FILES}"
        @echo "FILESDIR: ${FILESDIR}"

PROGS = cxx-prog
SRCS.cxx-prog = main.cxx

CXX ?= clang++

.if "${WITH_DOCS}" == "true"
FILES = docu/COPYRIGHT docu/doc.html docu/README
.endif

.if "${WITH_CUSTOM}" == "true"
DOCDIR = ${DATADIR}/doc/${PROJECTNAME}
FILESDIR = ${DOCDIR}
.endif

.include <mkc.prog.mk>

step 2: Build and Test

Build

$ mkcmake
$ mkcmake clean
$ mkcmake cleandir
$ mkcmake

print-info (default)

$ mkcmake print-info
PROJECTNAME: tmp
DESTDIR:
PREFIX: /usr/local
DATADIR: /usr/local/share
DOCDIR:
FILES:
FILESDIR: /usr/local/bin

print-info (with user settings)

$ mkcmake print-info WITH_DOCS=true WITH_CUSTOM=true PROJECTNAME=CxxDemo DESTDIR=/my-system PREFIX=/xjail
PROJECTNAME: CxxDemo
DESTDIR: /my-system
PREFIX: /xjail
DATADIR: /xjail/share
DOCDIR: /xjail/share/doc/CxxDemo
FILES: docu/COPYRIGHT docu/doc.html docu/README
FILESDIR: /xjail/share/doc/CxxDemo

step 3: Install

Install

$ doas mkcmake install WITH_DOCS=true WITH_CUSTOM=true PROJECTNAME=CxxDemo DESTDIR=/my-system PREFIX=/xjail

Show Installed Files

$ ls -R /my-system
xjail

/my-system/xjail:
bin   share

/my-system/xjail/bin:
cxx-prog

/my-system/xjail/share:
doc

/my-system/xjail/share/doc:
CxxDemo

/my-system/xjail/share/doc/CxxDemo:
COPYRIGHT doc.html  README

Docs

© SpartanCoin Xjail