pkgsrc infrastructure files

12 views
Skip to first unread message

Larson, Timothy E.

unread,
Apr 5, 2010, 4:36:10 PM4/5/10
to min...@googlegroups.com
I was contacted about the pkgsrc infrastructure post I made earlier, so I thought I'd share it with the list to save repeating myself.

The canonical way to get pkgsrc set up on a non-(Net and perhaps Dragonfly)BSD system is to bootstrap it. If you have checked out pkgsrc from cvs, you should have /usr/pkgsrc/bootstrap. The bootstrap script there is what will set up your pkgsrc environment.

For this script to run correctly and create a cohesive environment, rather than manually building a random assortment of tools, you need to create some files for its infrastructure to work properly. Most of these files reside in /usr/pkgsrc/mk. Once you create these, you ought to be able to get up-and-running by simply running /usr/pkgsrc/bootstrap/bootstrap. "Ought to" because that's where the porting effort begins in earnest. :) These are all mentioned in the Pkgsrc Guide at netbsd.org if you want more information.

I started documenting my work at wiki.netbsd.se/How_to_use_pkgsrc_on_MINIX. Given that I was trying to use 3.1.5 at the time, I didn't get all that far.


It is probably obvious where to put these blocks in mk/bsd.prefs.mk:


.elif $(OPSYS) == "Minix"
LOWER_OPSYS?= minix
LOWER_ARCH!= ${UNAME} -p
LOWER_VENDOR?= pc
MACHINE_ARCH?= ${LOWER_ARCH}
_OS_VERSION!= echo `${UNAME} -r`.`${UNAME} -v`


.elif ${OPSYS} == "Minix"
OBJECT_FMT?= a.out


This is my mk/platform/Minix.mk:


# Variable definitions for the Minix operating system.
# Some of these are best guesses - TL

ECHO_N?= ${ECHO} -n
IMAKE_MAKE?= ${MAKE} # program which gets invoked by imake
PKGLOCALEDIR?= share
PS?= /usr/bin/ps
SU?= /usr/bin/su
TYPE?= type # shell builtin

USERADD?= /usr/bin/adduser
GROUPADD?= # Minix doesn't have one!

CPP_PRECOMP_FLAGS?= # unset
DEF_UMASK?= 022
DEF_UMASK?= /dev/null
NOLOGIN?= /usr/bin/noshell
PKG_TOOLS_BIN?= ${LOCALBASE}/sbin
ROOT_CMD?= ${SU} - root -c
ROOT_USER?= root
ROOT_GROUP?= operator
SERIAL_DEVICES?= /dev/null

_OPSYS_HAS_INET6= no
_OPSYS_HAS_JAVA= no


Here's my mk/tools/tools.Minix.mk:


# System-supplied tools for the Minix operating system.

TOOLS_PLATFORM.[?= /bin/[
TOOLS_PLATFORM.awk?= /usr/bin/awk
TOOLS_PLATFORM.basename?= /usr/bin/basename
TOOLS_PLATFORM.cat?= /bin/cat
TOOLS_PLATFORM.chgrp?= /usr/bin/chgrp
TOOLS_PLATFORM.chmod?= /usr/bin/chmod
TOOLS_PLATFORM.chown?= /usr/bin/chown
TOOLS_PLATFORM.cmp?= /usr/bin/cmp
TOOLS_PLATFORM.cp?= /bin/cp
TOOLS_PLATFORM.cut?= /usr/bin/cut
TOOLS_PLATFORM.date?= /bin/date
TOOLS_PLATFORM.diff?= /usr/bin/diff
TOOLS_PLATFORM.dirname?= /usr/bin/dirname
TOOLS_PLATFORM.echo?= /bin/echo
TOOLS_PLATFORM.egrep?= /usr/bin/egrep
TOOLS_PLATFORM.env?= /usr/bin/env
TOOLS_PLATFORM.expr?= /usr/bin/expr
TOOLS_PLATFORM.false?= /bin/false
TOOLS_PLATFORM.fgrep?= /usr/bin/fgrep
TOOLS_PLATFORM.file?= /usr/bin/file
TOOLS_PLATFORM.find?= /usr/bin/find
TOOLS_PLATFORM.flex?= /usr/bin/flex
TOOLS_PLATFORM.ftp?= /usr/bin/ftp
TOOLS_PLATFORM.grep?= /usr/bin/grep
TOOLS_PLATFORM.head?= /usr/bin/head
TOOLS_PLATFORM.id?= /usr/bin/id
TOOLS_PLATFORM.install?= /bin/install
TOOLS_PLATFORM.ln?= /bin/ln
TOOLS_PLATFORM.ls?= /usr/bin/ls
TOOLS_PLATFORM.m4?= /usr/bin/m4
TOOLS_PLATFORM.mail?= /usr/bin/mail
TOOLS_PLATFORM.mv?= /bin/mv
TOOLS_PLATFORM.nice?= /usr/bin/nice
TOOLS_PLATFORM.nroff?= /usr/bin/nroff
TOOLS_PLATFORM.pax?= /usr/bin/pax
TOOLS_PLATFORM.pwd?= /bin/pwd
TOOLS_PLATFORM.rm?= /bin/rm
TOOLS_PLATFORM.rmdir?= /usr/bin/rmdir
TOOLS_PLATFORM.sh?= /bin/sh
TOOLS_PLATFORM.sleep?= /usr/bin/sleep
TOOLS_PLATFORM.sort?= /usr/bin/sort
TOOLS_PLATFORM.strip?= /usr/bin/strip
TOOLS_PLATFORM.tail?= /usr/bin/tail
TOOLS_PLATFORM.tar?= /usr/bin/tar
TOOLS_PLATFORM.tee?= /usr/bin/tee
TOOLS_PLATFORM.test?= /bin/test
TOOLS_PLATFORM.touch?= /usr/bin/touch
TOOLS_PLATFORM.tr?= /usr/bin/tr
TOOLS_PLATFORM.true?= /bin/true
TOOLS_PLATFORM.tsort?= /usr/bin/tsort
TOOLS_PLATFORM.wc?= /usr/bin/wc
TOOLS_PLATFORM.xargs?= /usr/bin/xargs
TOOLS_PLATFORM.yacc?= /usr/bin/yacc


And finally, here's my pkgtools/bootstrap-mk-files/files/mods/Minix.sys.mk file:


unix?= We run Unix.

.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4

.LIBS: .a

AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib

AS?= /usr/gnu/i386-pc-minix/bin/as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}

CC?= gcc
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}

CXX?= g++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}

OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}

CPP?= cpp
NOLINT= 1
CPPFLAGS?=

INSTALL?= install

LD?= /usr/gnu/i386-pc-minix/bin/ld
LDFLAGS?=

LORDER?= echo

MAKE?= make

NM?= nm

PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}

SHELL?= sh

SIZE?= size

TSORT?= tsort

YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}

# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}

# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} .cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o

# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o

# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o

# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c

# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c

# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}


Tim

--
Tim Larson
App Admin, Intercall Production Services

Gautam BT

unread,
Apr 5, 2010, 5:31:38 PM4/5/10
to Larson, Timothy E., min...@googlegroups.com
Thanks for the mail, it was very informative.

--
Gautam
Reply all
Reply to author
Forward
0 new messages