Prefix Portage Installation Guide for IRIX
Firstly, you need to decide where your prefix installation will be located: I'd suggest '/opt/gentoo/' (the more obvious '/opt/portage/' looks a little odd for paths such as '/opt/portage/usr/portage/...').
Create this directory, and subdirectory named 'home' within it. Create the user and group 'portage:portage' with UID and GID 250 with the recently-created 'home' directory as their home directory, and then recursively change ownership of the top-level installation directory to 'portage:portage'.
Save the following script as '~portage/.bashrc', altering EPREFIX as necessary:
Code:
EPREFIX="/opt/gentoo"
CHOST="mips-sgi-irix6.5"
PATH="${EPREFIX}/sbin:${EPREFIX}/usr/sbin:\
${EPREFIX}/usr/${CHOST}/bin:\
${EPREFIX}/usr/bin:${EPREFIX}/bin:\
/opt/bin:/usr/local/bin:\
/usr/nekoware/bin:/usr/bsd/bin:\
/usr/nekoware/sbin:/usr/bsd/sbin:$PATH"
export PATH EPREFIX CHOST
LD_LIBRARYN32_PATH="${EPREFIX}/usr/lib:${EPREFIX}/lib:${EPREFIX}/usr/lib/nspr"
export LD_LIBRARYN32_PATH
# This breaks most builds...
#ac_cv_path_RAWCPP="$( which cpp )"
CC="cc"
BUILD_CC="cc"
CXX="CC"
CXXCPP="CC -E"
export CC BUILD_CC CXX CXXCPP # ac_cv_path_RAWCPP
MIPSPRO_DEBUG=0
MIPSPRO_VERBOSE=0
MIPSPRO_PERMISSIVE=0
export MIPSPRO_DEBUG MIPSPRO_VERBOSE MIPSPRO_PERMISSIVE
# This should now all be handled by the IRIX MIPSpro wrapper...
# ... but some builds (such as perl) interrogate these flags directly without
# going via the compiler, so we do need to define them in the environment
# regardless.
common="-O2 -n32 -mips4 -r14000 -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2"
# cc-1035 is generated when the compiler hits '#error', but by default it
# is treated only as a warning. This is broken.
common="$common -diag_error 1035"
# There are various problems building C++ code with MIPSpro 7.4.4m compiler
# front-end, which can actually produce incorrect code. This can be worked-
# around by using the 7.4.3m front-end, which appears not to be affected.
fixcxx="-LANG:std=off:libc_in_namespace_std=off -Zf,_245"
# Comment out the following line to increase C++ compatibility...
unset fixcxx
bsdcompat="-D_BSD_COMPAT"
bsdfull="-D_BSD_TYPES -D_BSD_TIME" # -D_BSD_SIGNALS : Breaks use of <sigaction.h>
quiet="-woff 1174,1183,1185,1552"
ccquiet="${quiet},3968,3970"
# With `-Zf,_245', the higher error numbers aren't set...
if [ -n "$( echo "${fixcxx}" | grep "_245" )" ]; then
cxxquiet="${quiet}"
else
cxxquiet="${ccquiet}"
fi
nowarn="-woff 1009,1014,1110,1116,1188,1204,1230,1233 -Wl,-woff,84,-woff,85"
# Additional options:
# -signed Make variables of type 'char' default to 'signed char' rather than
# 'unsigned char'
#
CPPFLAGS="${BSDCOMPAT} -I${EPREFIX}/usr/include"
CFLAGS="-c99 ${common} ${ccquiet}"
CXXFLAGS="-J2 ${common} -FE:eliminate_duplicate_inline_copies:template_in_elf_section ${cxxquiet} ${fixcxx}"
LDFLAGS="-Wl,-s,-x,-n32,-mips4,-rdata_shared,-allow_jump_at_eop" # -v
LDFLAGS="${LDFLAGS},-rpath,${EPREFIX}/usr/lib:${EPREFIX}/lib -L${EPREFIX}/usr/lib -L${EPREFIX}/lib"
unset common fixcxx bsdcompat bsdfull quiet ccquiet cxxquiet nowarn
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
# Other random fixes...
CONFIG_SHELL="$( which bash )"
export CONFIG_SHELL
gentoopath="${EPREFIX}/usr/share/man:${EPREFIX}/usr/man"
sysman="/usr/catman:/usr/share/man:/usr/share/catman"
optman="/opt/man:/opt/modules/2.2.2.5/man"
sgiman="/usr/freeware/catman:/var/sgi_apache/server/man"
localman="/usr/local/man"
bsdman="/usr/bsd/catman:/usr/bsd/man:/usr/bsd/lib/perl5/man:/usr/bsd/lib/perl5/site_perl/man:/usr/bsd/lib/perl5/vendor_perl/man"
nekoman="/usr/nekoware/man:/usr/nekoware/ssl/man"
MANPATH="$gentoopath:$sysman:$optman:$sgiman:$localman:$bsdman:$nekoman"
#MANFMTCMD="groff -Tascii -man"
export MANPATH # MANFMTCMD
unset gentoopath sysman optman sgiman localman bsdman nekoman
# The 'rs', 'hl' and 'ca' directives don't work as of coreutils-7.1
type -pf dircolors >/dev/null && eval $( dircolors -b | sed 's/rs=[^:]\+:// ; s/:hl=[^:]\+:/:/ ; s/:ca=[^:]\+:/:/' )
alias ls='ls --color=auto -hF'
alias grep='grep --colour'
alias man='PAGER="less" man'
EDITOR="vim"
export EDITOR
XDG_DATA_HOME=/opt/gentoo/usr/share
XDG_DATA_DIRS=/opt/gentoo/usr/share
export XDG_DATA_HOME XDG_DATA_DIRS
# set vi:nowrap
Finally, download the bootstrap script from
http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt
and the compiler wrapper from
http://files.irix-tools.homeunix.net/irix/IRIX-MIPSpro-wrapper.tar.bz2
.
Become your portage user, copy the bootstrap script to your home directory, and extract the IRIX-MIPSpro-wrapper archive to your installation root directory (e.g. 'tar -xjvf IRIX=MIPSpro-wrapper.tar.bz2 -C /opt/gentoo/'). Finally run 'hash -r', and from now on you should be using the compiler wrappers. These are controlled by the
MIPSPRO_
* variables -
MIPSPRO_VERBOSE=1
will result in copious output regarding what the wrapper is doing, and
MIPSPRO_DEBUG=1
will show additional debugging information. Additional options are
MIPSPRO_WRAPPER
(set to 0 to disable the wrapper entirely, which is highly unrecommended!),
MIPSPRO_ALLOWNOSTD
(to allow -nostdlib and -nostdinc, which generally break builds: default off),
MIPSPRO_MANGLE
(to add additional optimisations beyond simply setting library paths: default on),
MIPSPRO_INJECT
(experimental fix for use of GNU __attribute__s: default off),
MIPSPRO_PERMISSIVE
(to pass unrecognised options to the compiler even though they're likely GNUisms: default on for now), and
MIPSPRO_ABORT
(when
MIPSPRO_PERMISSIVE
is set to 0, the wrapper exits with a failure if an unrecognised option is encountered, rather than silently dropping it: default off).
By default, the wrapper will auto-detect your platform (e.g. "IP30") and CPU (e.g. "r14000"). Other optimisation options default to '-mips4', '-n32', and '-O2' with an Olimit of 8192. These can be overridden with MIPSPRO_ISA, MIPSPRO_ABI, OLIMIT, and MIPSPRO_OPT.
As per the
Solaris
and
Mac OS
installation guides, as your portage user now run:
Code:
$ chmod 755 bootstrap-prefix.sh
$ STDPATH="$PATH"
$ export PATH="$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:$PATH"
$ ./bootstrap-prefix.sh $EPREFIX tree
At this point, you may need to apply the flag-o-matic patch from the note at the bottom of this post. In any case, proceed with:
Code:
$ ./bootstrap-prefix.sh $EPREFIX/tmp make
$ ./bootstrap-prefix.sh $EPREFIX/tmp wget
$ ./bootstrap-prefix.sh $EPREFIX/tmp sed
$ ./bootstrap-prefix.sh $EPREFIX/tmp python
$ ./bootstrap-prefix.sh $EPREFIX/tmp coreutils6
$ ./bootstrap-prefix.sh $EPREFIX/tmp findutils
$ ./bootstrap-prefix.sh $EPREFIX/tmp tar15
$ ./bootstrap-prefix.sh $EPREFIX/tmp patch9
$ ./bootstrap-prefix.sh $EPREFIX/tmp grep
$ ./bootstrap-prefix.sh $EPREFIX/tmp gawk
$ ./bootstrap-prefix.sh $EPREFIX/tmp bash
$ ./bootstrap-prefix.sh $EPREFIX portage
$ hash -r
$ USE="-*" emerge --oneshot -v --keep-going sed wget bash baselayout-prefix lzma-utils m4 flex bison coreutils findutils tar grep patch gawk make
$ USE="-*" emerge --oneshot -v --nodeps file
$ FEATURES="-collision-protect" emerge -v --oneshot portage
$ export PATH="$STDPATH"
$ unset STDPATH
$ hash -r
$ rm -r $EPREFIX/tmp/*
$ emerge --sync
$ emerge -uv system
$ emerge -Dev --with-bdeps y system
... which should result in a minimal but working and fully-installed system!
You can now use this as any user by adding "/opt/portage/usr/bin:/opt/portage/bin" to their PATH.
Please note
This initial installation stage may be fragile, or may run into unforeseen problems. Please expect this, but also please don't be disheartened. Simply post any problems here or IM me, and we can sort it out. This setup has worked for me on a couple of different machines, but hasn't received any wider testing. Only mips4 n32 code on R10k+ processors has been tested - o32 may be slighly more compatible with legacy code which resides within certain source-trees still (such as _ctypes/FFI support in Python), whilst 64bit support is untried.
I have pre-built stages available for IP30/R12k, IP30/R14k, and IP35/R14k - although above R10k, the binaries will run happily on any CPU. I plan to assemble and upload these shortly.
There is a file installed to $EPREFIX/home/patches/flag-o-matic.eclass.patch which should be applied (with 'patch -p0') after every sync - without this, builds using "append-flags -L" (notably Python) will fail.