mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
Added the RPM installer builder to contrib.
This commit is contained in:
parent
f2536cddff
commit
3e73ac29b2
42
contrib/rpm/README
Normal file
42
contrib/rpm/README
Normal file
@ -0,0 +1,42 @@
|
||||
Building Moses RPM
|
||||
==================
|
||||
|
||||
*** WARNING ***
|
||||
Before completing *any* of the tasks outlined in this README, please commit and push any changes you wish to be included in your installer.
|
||||
*** WARNING ***
|
||||
|
||||
|
||||
Building the RPM SPEC file
|
||||
--------------------------
|
||||
|
||||
The first phase is to construct the RPM SPEC file in $HOME/rpmbuild. The build_source.sh script builds all the artefacts needed to build. This script needs the following information:
|
||||
|
||||
- The Git repository from which an installer will be built,
|
||||
- The branch in the Git repository to build, and
|
||||
- The version of the installed Moses distribution.
|
||||
|
||||
For example, to build the RELEASE-1.0 branch in the mosesdecode repository (git://github.com/moses-smt/mosesdecoder.git):
|
||||
|
||||
$ build_source.sh -r git://github.com/moses-smt/mosesdecoder.git -b RELASE-1.0 -v 1.0
|
||||
|
||||
This builds the source tarballs in the $HOME/rpmbuild/SOURCES directory and the moses.spec file in $HOME/rpmbuild/SPECS.
|
||||
|
||||
|
||||
Building the RPM
|
||||
----------------
|
||||
|
||||
Change directory to $HOME/rpmbuild, and build the binary RPM with:
|
||||
|
||||
$ rpmbuild -bb SPECS/moses.spec
|
||||
|
||||
This will download IRSTLM v5.70.04 and GIZA++ v2, then build them along with Moses and make the RPM in the directory $HOME/rpmbuild/RPMS/<architecture>/moses-<version>-1.<architecture>.rpm.
|
||||
|
||||
For example building on a 64 bit Intel architecture, and building v1.0 the RPM would be called moses-1.0-1.x86_64.rpm.
|
||||
|
||||
|
||||
Building a Debian package
|
||||
-------------------------
|
||||
|
||||
The Alien tool converts RPM packages to Debian packages. If a Debian package is required then follow the instructions on the following web-page:
|
||||
|
||||
https://help.ubuntu.com/community/RPM/AlienHowto
|
63
contrib/rpm/build_source.sh
Executable file
63
contrib/rpm/build_source.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
BRANCH="master"
|
||||
declare -i NO_RPM_BUILD=0
|
||||
declare -r RPM_VERSION_TAG="___RPM_VERSION__"
|
||||
|
||||
function usage() {
|
||||
echo "`basename $0` -r [Moses Git repo] -b [Moses Git branch: default ${BRANCH}] -v [RPM version]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -lt 4 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
while getopts r:b:v:nh OPTION
|
||||
do
|
||||
case "$OPTION" in
|
||||
r) REPO="${OPTARG}";;
|
||||
b) BRANCH="${OPTARG}";;
|
||||
v) VERSION="${OPTARG}";;
|
||||
n) NO_RPM_BUILD=1;;
|
||||
[h\?]) usage;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -d ./rpmbuild ]; then
|
||||
echo "RPM build directory not in current working direcotry"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -r MOSES_DIR="moses-${VERSION}"
|
||||
git clone ${REPO} ${MOSES_DIR}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to clone Git repository ${REPO}"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
cd ${MOSES_DIR}
|
||||
|
||||
git checkout ${BRANCH}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to checkout branch ${BRANCH}"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
tar -cf moses-${VERSION}.tar ${MOSES_DIR}
|
||||
gzip -f9 moses-${VERSION}.tar
|
||||
|
||||
if [ ${NO_RPM_BUILD} -eq 0 ]; then
|
||||
if [ ! -d ${HOME}/rpmbuild/SPECS ]; then
|
||||
mkdir -p ${HOME}/rpmbuild/SPECS
|
||||
fi
|
||||
eval sed s/${RPM_VERSION_TAG}/${VERSION}/ ./rpmbuild/SPECS/moses.spec > ${HOME}/rpmbuild/SPECS/moses.spec
|
||||
if [ ! -d ${HOME}/rpmbuild/SOURCES ]; then
|
||||
mkdir -p ${HOME}/rpmbuild/SOURCES
|
||||
fi
|
||||
mv moses-${VERSION}.tar.gz ${HOME}/rpmbuild/SOURCES
|
||||
fi
|
||||
|
||||
rm -Rf ${MOSES_DIR}
|
65
contrib/rpm/rpmbuild/SPECS/moses.spec
Normal file
65
contrib/rpm/rpmbuild/SPECS/moses.spec
Normal file
@ -0,0 +1,65 @@
|
||||
Name: moses
|
||||
Summary: Moses is a statistical machine translation system that allows you to automatically train translation models for any language pair.
|
||||
Version: ___RPM_VERSION__
|
||||
Release: 1
|
||||
URL: http://www.statmt.org/moses/
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
License: LGPL
|
||||
Group: Development/Tools
|
||||
Vendor: Capita Translation and Interpreting
|
||||
Packager: Ian Johnson <ian.johnson@capita-ti.com>
|
||||
Requires: boost >= 1.48, python >= 2.6, perl >= 5
|
||||
BuildRoot: /home/ian/rpmbuild/builds/%{name}-%{version}-%{release}
|
||||
%description
|
||||
Moses is a statistical machine translation system that allows you to automatically train translation models for any language pair. All you need is a collection of translated texts (parallel corpus). An efficient search algorithm finds quickly the highest probability translation among the exponential number of choices.
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/opt/moses/giza++-v2
|
||||
|
||||
wget -O $RPM_BUILD_DIR/irstlm-5.70.04.tgz http://moses-suite.googlecode.com/files/irstlm-5.70.04.tgz
|
||||
wget -O $RPM_BUILD_DIR/giza-pp-v1.0.7.tgz http://moses-suite.googlecode.com/files/giza-pp-v1.0.7.tar.gz
|
||||
|
||||
cd $RPM_BUILD_DIR
|
||||
|
||||
tar -zxf irstlm-5.70.04.tgz
|
||||
tar -zxf giza-pp-v1.0.7.tgz
|
||||
|
||||
cd irstlm-5.70.04
|
||||
bash regenerate-makefiles.sh --force
|
||||
./configure --prefix $RPM_BUILD_ROOT/opt/moses/irstlm-5.70.04
|
||||
make
|
||||
make install
|
||||
|
||||
cd ../giza-pp
|
||||
make
|
||||
cp $RPM_BUILD_DIR/giza-pp/GIZA++-v2/GIZA++ $RPM_BUILD_DIR/giza-pp/GIZA++-v2/snt2cooc.out $RPM_BUILD_DIR/giza-pp/mkcls-v2/mkcls $RPM_BUILD_ROOT/opt/moses/giza++-v2
|
||||
%build
|
||||
./bjam --with-irstlm=$RPM_BUILD_ROOT/opt/moses/irstlm-5.70.04 --with-giza=$RPM_BUILD_ROOT/opt/moses/giza++-v2 -j2
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R bin $RPM_BUILD_ROOT/opt/moses
|
||||
cp -R scripts/analysis $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/ems $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/generic $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/other $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/recaser $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/regression-testing $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/share $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/tokenizer $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
cp -R scripts/training $RPM_BUILD_ROOT/opt/moses/scripts
|
||||
%clean
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
/opt/moses/bin/*
|
||||
/opt/moses/scripts/analysis/*
|
||||
/opt/moses/scripts/ems/*
|
||||
/opt/moses/scripts/generic/*
|
||||
/opt/moses/scripts/other/*
|
||||
/opt/moses/scripts/recaser/*
|
||||
/opt/moses/scripts/regression-testing/*
|
||||
/opt/moses/scripts/share/*
|
||||
/opt/moses/scripts/tokenizer/*
|
||||
/opt/moses/scripts/training/*
|
||||
/opt/moses/irstlm-5.70.04/*
|
||||
/opt/moses/giza++-v2/*
|
Loading…
Reference in New Issue
Block a user