//$Id: pipeline.txt,v 1.5 2016/04/20 23:58:27 lpsmith Exp $

Instructions for compiling lamarc and lam_conv for all major
platforms, tested December 2013, revised September 2014.

******
On Linux (tested on two Ubuntu 64-bit machines):

cvs checkout of lamarc
cd into lamarc
make a directory buildwxopt for wxWidgets build
cd into buildwxopt
configure using the following:
../configure --enable-buildwx
(this defaults to 2.8.12)
go back up to lamarc
make a directory opt for lamarc build
cd into opt
build lamarc and lam_conv using the following configuration:
../configure --with-wx-config=../buildwxopt/wxWidgets-2.8.12/wx-config --no-create --no-recursion
make

This creates executables lamarc and lam_conv.  Put them in a directory whose name
is the release name (e.g. lamarc-2.1.9-Linux-i686-gtk).  Tar that directory
using tar cvzf to produce a gzipped tar file which will by default end in .tgz.
Put that on the web site in /felsenstein/www/html/downloads.  Make the linux
entry in lamarc_downloads.html point to it.  Note:  doing tar followed by
gzip and renaming the result to .tgz is NOT equivalent!

Note 9/2014:  We had to add -lX11 to the Makefile to make this compile
on recent gcc.  Unfortunately this does not work for any other platform
(including Windows cross-compiles on Linux) and has to be edited out again
before trying those compiles.  We'll try to make it conditional but have
not yet succeeded.

(What did not work:  The Sanity scripts that are supposed to do this
automatically.)

******

On MacOSX:

As of 4/2016, we successfully compiled wxWidgets again, after having 
lost that ability.  Yay!  See wx-osx-notes.txt for compiling that.

If gcc and/or cvs are missing, they may be available through the XCode 
Tools (install XCode Command Line Tools).  If you want a version of 
XCode for your current OS, but that OS is not the latest, you can still 
get the older versions, but you'll have to sign in as a Mac developer to 
get them.  See https://developer.apple.com/xcode/download/, and scroll 
down to 'additional tools'.  Not only do you need to install XCode, but 
you'll also need to install the 'Command Line Tools' to get the full 
package of what we need for lamarc.

To install CVS, the simplest method I found was to install 'brew', and 
using that to install CVS.  Once 'brew' was up and running:

  brew install cvs 

worked like a charm.

On kolmogorov:

Makefile.am has been modified to automatically set the macosx minimum 
version to 10.7, so 'configure' no longer needs to do this.  It does 
mean that Makefile.am will need to be updated in the future if this 
minimum version changes.

It is possible to use the flags '--disable-unicode' and 
'--disable-shared', but it is unclear why they were being used in the 
first place.  Lamarc and lam_conv seem to work OK without them.  Ditto 
'--with-osx-cocoa' and '--with-macosx-sdk'.  As of right now, this will 
work:

cvs checkout of lamarc
cd into lamarc
make directory opt
cd into opt
  export WX_INSTALL=/Users/lpsmith/wxWidgets-3.1.0
  ../configure  --with-wx-config=${WX_INSTALL}/opt/wx-config
  make

If things go wrong, try adding in some of the older options that seem to 
used to be required:

  export WX_INSTALL=/Users/lpsmith/wxWidgets-3.1.0
  ../configure --disable-unicode --disable-shared \
      --with-osx_cocoa \
      --with-macosx-version-min=10.7 \
      --with-macosx-sdk=/Developer/SDKs/MacOSX10.7.sdk \
      --with-wx-config=${WX_INSTALL}/opt/wx-config

(It should no longer be necessary to edit out '-lX11' from the generated 
Makefile; this is now handled in Makefile.am)

This produces an apparently useless lamarc and lam_conv, plus
lamarc.app and lam_conv.app directories which are what you actually
want.

Put lamarc.app and lam_conv.app into a directory named for the 
release, such as lamarc-2.1.9.  (Don't add suffix "-osx" as the
script does this automatically.)

Remove any directories named "build" before running this script.
Run the script buildDmg.sh (it can be found in lamarc/scripts/):

buildDmg.sh <name of directory with the .apps in it>

This will create a "build" directory containing a .dmg file.
Transfer this .dmg to a DIFFERENT Mac and test both clickability
and command-line runnability (use "open" to run on command
line).  Be sure to test lam_conv as it is the more vulnerable
of the two, and always use a different Mac than the one you
compiled on.

(What did not work:  

any attempts to make universal binaries
)

******

On MSW:

We installed mingw32 on griffiths.gs using instructions on its
web site.  Hopefully this doesn't need to be done again.

make a clean cvs checkout of lamarc on griffiths

** make wxwidgets
NOTE:  If you previously did a 32 bit install be sure to do
ALL OF THIS again.  Also, if you are using a pre-existing directory
you must do "make distclean" before proceeding.  "make clean" is
not enough.  This applies to both wxWidgets and Lamarc.

cd to ~mkkuhner/src/wxWidgets/wxWidgets-3.0.0
make a directory msw-64
  export HOST_TYPE=x86_64-w64-mingw32
  export WX_INSTALL_LOC=$HOME/wx-libs

  ../configure --disable-shared --with-libtiff=builtin \
      --host=$HOST_TYPE \
      --prefix=$WX_INSTALL_LOC
  make
  make install

** make lamarc
cd back to lamarc
make a directory msw
cd into msw
  ../configure --host=$HOST_TYPE \
        --with-wx-config=$WX_INSTALL_LOC/wxMSW/bin/wx-config
edit Makefile to remove two references to -lX11
  make

this will create lamarc.exe and lam_conv.exe
put them into a directory whose name is the version name, such as
lamarc-2.1.9-Windows.
tar this directory using tar -cvf (don't compress it)
transfer this file to a Windows machine; put it on the Desktop
right-click on it and select 7-zip > extract files
change "location to extract" to the Desktop (otherwise you get a spurious
  level of indirection)
right click on the resulting folder (not the tar file!)
choose 7-zip > add to archive and make a .zip file

(What did not work: trying to compile any version of wxWidgets on 
our Windows box either with mingw or cygwin; cross-compiling on lamarc.gs--
probably due to wrong "modules" commands.)

***

On MSW for 32-bit target:

NOTE:  If you previously did a 64 bit install be sure to do
ALL OF THIS again.  Also, if you are using a pre-existing directory
you must do "make distclean" before proceeding.  "make clean" is
not enough.  This applies to both wxWidgets and Lamarc.

make a clean cvs checkout of lamarc on griffiths

make wxwidgets:

cd into ~mkkuhner/src/wxWidgets/wxWidgets-3.0.0
make a directory msw-32
cd into it
export HOST_TYPE=i686-w64-mingw32
(yes, w64 even for 32-bit builds)
export WX_INSTALL_LOC=$HOME/wx-libs32

  ../configure --disable-shared --with-libtiff=builtin \
      --host=$HOST_TYPE \
      --prefix=$WX_INSTALL_LOC
  make
  make install

cd back to lamarc
make a directory msw
cd into msw
  ../configure --host=$HOST_TYPE \
        --with-wx-config=$WX_INSTALL_LOC/bin/wx-config
edit Makefile to remove two references to -lX11
  make

this will create lamarc.exe and lam_conv.exe
put them into a directory whose name is the version name, such as
lamarc-2.1.9-Win32.
tar this directory using tar -cvf (don't compress it)
transfer this file to a Windows machine; put it on the Desktop
right-click on it and select 7-zip > extract files
change "location to extract" to the Desktop (otherwise you get a spurious
  level of indirection)
right click on the resulting folder (not the tar file!)
choose 7-zip > add to archive and make a .zip file

WARNING:  I don't see why this recipe would produce a 32-bit compile,
and I don't have a 32-bit machine to test it on, so it must be
regarded with suspicion!

(What did not work: trying to compile any version of wxWidgets on 
our Windows box either with mingw or cygwin; cross-compiling on lamarc.gs--
probably due to wrong "modules" commands.)

***

Everywhere:

Transfer the files to evolution.gs.washington.edu (to get them off
the Windows machine, try Dropbox).

The Lamarc web pages are at:
/felsenstein/www/html/lamarc/

You will need to edit index.html to describe the new release, and
lamarc_download.html to point to the new executables.
