# -*- makefile-gmake -*-

# to do: record an origin in the package for package deletion time:
#     pkg_add: package Macaulay2-1.1.99 has no origin recorded

DIRECTORY = freebsd
include Makefile.include
CONFIGOPTIONS += --prefix=/usr/local
CONFIGOPTIONS += --enable-freebsd

CPPFLAGS="-I/usr/local/include"
LDFLAGS="-L/usr/local/lib"

# The other freebsd ports all put man pages in /usr/local/man, so
# I put these two options together just in case the common staging area is
# is used with one of our other ports that has --mandir at the default value:
CONFIGOPTIONS += --disable-common-staging-area --mandir='$${prefix}/man'

default: install check
INSTALLOPTIONS += prefix=/usr/local/encap

pre-install:;	rm -rf /usr/local/encap/Macaulay2-$(PACKAGE_VERSION)
arch-chk:
	[ `hostname` = freebsd.gallium ]
	[ `uname -m` = i386 ]

# build instructions under freebsd 7.1-RELEASE

# to see what's there:
#   ftp ftp.freebsd.org
#   cd pub/FreeBSD/ports/i386/packages-7.1-release/Latest


# start with the developer's freebsd, X11 not needed,
# with a 4GB disk, of which 3GB will be used

# actually, it appears that asking for a 4GB disk gets a disk that occupies
# 4 billion bytes on the host system:

#      /home/dan/.VirtualBox/VDI:
#      total used in directory 3802048 available 41142496
#      -rw------- 1 dan dan 3990897152 Jan 27 14:35 freebsd-7.0.vdi

# but you get only 3748149248 butes of that for the guest system:

#        freebsd$ df
#        Filesystem  1K-blocks    Used  Avail Capacity  Mounted on
#        /dev/ad0s1a   3660302  916758    73%    /

# and that really comes to just 3.49GB, of which 2.34GB is used.

# add yourself to the "wheel" group or su won't work

# use pkg_add -r to install the following packages:
# 
# required to build:
#   autoconf262
#   m4 (fetched by autoconf)
#   curl or wget
#   gmake
#   gtar
#   g95
#   libgmp (fetched by mpfr)
#   mpfr
#   gdbm
#   lapack (fetches blas, also)
#   ntl
#   boehm-gc -- in 7.1-RELEASE, too old, only version 6.8
#   gfind
# 
# optional but useful:
#   subversion
#   emacs
#   xauth
#   epkg
#   bash
#   gcc44 -- to update the compiler, version 4.2.1 is standard in 7.1-RELEASE
# 
# VirtualBox settings:
#  VBoxManage setextradata "Linux Guest" VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol  TCP
#  VBoxManage setextradata "Linux Guest" VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort 22
#  VBoxManage setextradata "Linux Guest" VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort  2222

# .ssh/config settings:
# Host freebsd
#   Hostname localhost
#   Port 2222

# test like this as root:
#    pkg_add Macaulay2-1.2-i386-FreeBSD-7.1-RELEASE.tbz 
#    /usr/local/bin/M2 -q

# Local Variables:
# compile-command: "time gmake -f Makefile.freebsd "
# End:
