Hi all,

in light of this recent thread re: compiling CWB from source, it occurred to me it might be useful to create a CWB package for Spack. Spack is a cross-platform package manager which builds software from source, automatically resolving dependencies so you don’t have to. A second advantage is that it doesn’t need to run with admin privileges. You just need Git and a fairly recent version of Python 2 (preferably, Python 3 works as well but you might hit snags).

I added cwb and cwb-perl packages to a fork of Spack I maintain, so installing trunk CWB can now be done like this:

git clone --depth 1 https://github.com/dlukes/spack.git
cd spack
# cwb is installed automatically as a dependency of cwb-perl
./bin/spack install cwb-perl
# symlink the cwb-perl package into perl
./bin/spack activate cwb-perl
# create a prefix where all relevant binaries will be symlinked
# (change /path/to/prefix to a directory of your choice)
./bin/spack view symlink /path/to/prefix cwb-perl
# update your PATH
export PATH="/path/to/prefix/bin:$PATH"
# use cwb
cwb-encode ...
cwb-make ...
cqp ...

A practical note: when testing this on Arch Linux, I found out that flex 2.6.4 doesn’t compile on my system. Fortunately, with Spack, you can request a specific version of a dependency:

# list information about the flex package in Spack, including
# available versions
./bin/spack info flex
# install cwb-perl with specific version of flex
./bin/spack install 'cwb-perl^flex@2.6.3'
# etc.

If you’d rather use Spack’s official repository (though my fork differs only slightly), you can, just manually add the cwb and cwb-perl package definitions where they belong in Spack’s directory tree:

git clone --depth 1 https://github.com/LLNL/spack.git
cd spack
mkdir -p var/spack/repos/builtin/packages/{cwb,cwb-perl}
cwb=var/spack/repos/builtin/packages/cwb/package.py
cwb_perl=var/spack/repos/builtin/packages/cwb-perl/package.py
curl https://raw.githubusercontent.com/dlukes/spack/develop/$cwb -o $cwb
curl https://raw.githubusercontent.com/dlukes/spack/develop/$cwb_perl -o $cwb_perl
./bin/spack install cwb-perl
# etc.

Note that if you have a working setup for installing CWB from source, you might as well keep using it :) But if you’re starting from scratch, you might find this easier, depending on circumstances. If this method doesn’t work for you, let me know via the issue tracker on GitHub.

Best,

David