|
1
2
3
4
|
#!/bin/bash
set -e -o pipefail
|
|
5
|
if [ "$#" -ne 4 ]; then
|
|
6
|
echo "Must provide exactly 4 arguments: <CROSSMORFEUSZ_ROOT> <INPUT_DICTIONARIES> <DEFAULT_DICT_NAME> <DICT_VERSION>"
|
|
7
8
9
|
exit 1
fi
|
|
10
11
|
export CROSSMORFEUSZ_ROOT="$1"
export INPUT_DICTIONARIES="$2"
|
|
12
|
export DEFAULT_DICT_NAME="$3"
|
|
13
|
export DICT_VERSION="$4"
|
|
14
15
|
export ANALYZER_DICTIONARY_CPP=`mktemp`.cpp
export GENERATOR_DICTIONARY_CPP=`mktemp`.cpp
|
|
16
|
export DICT_DIR=`mktemp -d`
|
|
17
18
|
function buildDictionaries {
|
|
19
|
|
|
20
|
INPUT_TAGSET=input/morfeusz-sgjp.tagset
|
|
21
22
23
24
25
26
|
SEGMENT_RULES_FILE=input/segmenty.dat
python fsabuilder/morfeusz_builder \
--input-files="$INPUT_DICTIONARIES" \
--tagset-file="$INPUT_TAGSET" \
--segments-file="$SEGMENT_RULES_FILE" \
|
|
27
28
29
30
|
--analyzer-cpp="$ANALYZER_DICTIONARY_CPP" \
--generator-cpp="$GENERATOR_DICTIONARY_CPP" \
--dict="$DEFAULT_DICT_NAME" \
--dict-dir="$DICT_DIR"
|
|
31
|
|
|
32
|
echo "DONE building dictionaries" >&2
|
|
33
|
}
|
|
34
|
|
|
35
|
function build {
|
|
36
|
set -e -o pipefail
|
|
37
38
|
os=$1
arch=$2
|
|
39
40
|
embedded=$3
shift
|
|
41
42
43
|
shift
shift
targets=$@
|
|
44
|
|
|
45
|
srcDir=`pwd`
|
|
46
|
buildDir=buildall/$os-$arch-$embedded
|
|
47
|
targetDir=$srcDir/target
|
|
48
|
toolchain=$srcDir/toolchains/Toolchain-$os-$arch.cmake
|
|
49
|
|
|
50
|
echo "Will use $toolchain toolchain"
|
|
51
|
|
|
52
|
rm -rf $buildDir
|
|
53
|
#~ rm -rf $targetDir
|
|
54
55
56
|
mkdir -p $buildDir
mkdir -p $targetDir
cd $buildDir
|
|
57
58
59
60
61
62
63
|
if [ "$embedded" = true ]
then
if [ "$os" == "Linux" ]
then
CPACK_GENERATOR=TGZ
fi
|
|
64
|
CMAKE_ARGS="-D CROSSMORFEUSZ_ROOT=$CROSSMORFEUSZ_ROOT \
|
|
65
66
67
68
69
70
|
-D CMAKE_TOOLCHAIN_FILE=$toolchain \
-D TARGET_DIR=$targetDir \
-D ANALYZER_DICTIONARY_CPP=$ANALYZER_DICTIONARY_CPP \
-D GENERATOR_DICTIONARY_CPP=$GENERATOR_DICTIONARY_CPP \
-D DEFAULT_DICT_NAME=$DEFAULT_DICT_NAME \
-D SKIP_DICTIONARY_BUILDING=1 \
|
|
71
72
|
-D EMBEDDED_DEFAULT_DICT=1 \
-D DICT_VERSION=$DICT_VERSION"
|
|
73
74
|
if [ "$CPACK_GENERATOR" != "" ]
then
|
|
75
|
CMAKE_ARGS="$CMAKE_ARGS -D CPACK_GENERATOR=$CPACK_GENERATOR"
|
|
76
|
fi
|
|
77
78
|
else
echo "setting default ACL to prevent control-file-has-bad-permissions lintian error"
|
|
79
|
setfacl -R -d -m o::rx -m g::rx -m u::rwx .
|
|
80
|
|
|
81
|
CMAKE_ARGS="-D CROSSMORFEUSZ_ROOT=$CROSSMORFEUSZ_ROOT \
|
|
82
83
84
85
86
|
-D CMAKE_TOOLCHAIN_FILE=$toolchain \
-D TARGET_DIR=$targetDir \
-D DEFAULT_DICT_DIR=$DICT_DIR \
-D DEFAULT_DICT_NAME=$DEFAULT_DICT_NAME \
-D SKIP_DICTIONARY_BUILDING=1 \
|
|
87
88
|
-D CPACK_GENERATOR=DEB \
-D DICT_VERSION=$DICT_VERSION"
|
|
89
|
fi
|
|
90
|
cmake $CMAKE_ARGS $srcDir 2>&1
|
|
91
|
echo "building $toolchain" >&2
|
|
92
|
make
|
|
93
|
make $targets
|
|
94
|
|
|
95
|
for f in `find "$targetDir" -name "*-Linux-*.deb"`
|
|
96
|
do
|
|
97
98
|
mv "$f" "`echo $f | sed -r 's/Linux-amd64.deb$/amd64.deb/' | sed -r 's/Linux-i386.deb/i386.deb/'`"
done
|
|
99
|
|
|
100
101
102
103
|
if [ "$os" = Linux -a "$embedded" = false ]; then
"$srcDir/createDictionaryDeb.sh" "$DICT_DIR" "${DEFAULT_DICT_NAME}" "${DICT_VERSION}" "${targetDir}"
fi
|
|
104
105
106
|
cd "$srcDir"
}
|
|
107
108
109
110
111
112
|
function log {
os=$1
arch=$2
stdbuf -oL sed -e $"s/^/$os-$arch:\t/" | tee "log/$os-$arch.out"
}
|
|
113
|
export -f build
|
|
114
|
export -f log
|
|
115
|
|
|
116
|
rm -rf log target
|
|
117
|
mkdir -p log
|
|
118
|
|
|
119
120
121
|
buildDictionaries 2>&1 | log All all
{
|
|
122
|
echo "build Linux amd64 true package package-java package-python package-builder 2>&1 | log Linux-tgz amd64"
|
|
123
|
echo "build Linux amd64 false lib-deb bin-deb dev-deb dictionary-deb java-deb 2>&1 | log Linux-deb amd64"
|
|
124
|
echo "LDFLAGS=-m32;CFLAGS=-m32;CXXFLAGS=-m32 build Linux i386 true package package-java 2>&1 | log Linux-tgz i386"
|
|
125
|
echo "LDFLAGS=-m32;CFLAGS=-m32;CXXFLAGS=-m32 build Linux i386 false lib-deb bin-deb java-deb 2>&1 | log Linux-deb i386"
|
|
126
127
128
|
echo "build Windows amd64 true package package-java 2>&1 | log Windows amd64"
echo "build Windows i386 true package package-java 2>&1 | log Windows i386"
echo "build Darwin amd64 true package package-java 2>&1 | log Darwin amd64"
|
|
129
|
} | xargs -n1 -P2 -d$'\n' bash -c
|
|
130
|
|
|
131
|
|