| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Copyright [2015-2024] EMBL-European Bioinformatics Institute |
| 4 |
# |
| 5 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 |
# you may not use this file except in compliance with the License. |
| 7 |
# You may obtain a copy of the License at |
| 8 |
# |
| 9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
# |
| 11 |
# Unless required by applicable law or agreed to in writing, software |
| 12 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
# See the License for the specific language governing permissions and |
| 15 |
# limitations under the License. |
| 16 |
|
| 17 |
# |
| 18 |
# Script for testing/installing various build configurations of Bio::DB::HTS |
| 19 |
# $1 - clone command for Bio::DB::HTS from GitHub |
| 20 |
# e.g. "git clone -b main https://github.com/Ensembl/Bio-DB-HTS.git" |
| 21 |
# Set this to be an alternative clone command if required |
| 22 |
# $2 - the test to be run, to match one of the options below |
| 23 |
# |
| 24 |
export PERL5LIB_ORIG=$PERL5LIB |
| 25 |
|
| 26 |
# |
| 27 |
# Tests the Build.PL with various options |
| 28 |
# |
| 29 |
if [ "$2" = "BUILD_SYSTEM_INSTALLED_HTSLIB" ]; then |
| 30 |
echo Installs htslib, then runs Bio::DB::HTS Build process |
| 31 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git |
| 32 |
cd htslib |
| 33 |
sudo make install |
| 34 |
cd .. |
| 35 |
$1 |
| 36 |
cd Bio-DB-HTS |
| 37 |
perl Build.PL |
| 38 |
./Build |
| 39 |
export PERL5LIB=$PERL5LIB:$(pwd -P)/lib:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/Faidx |
| 40 |
cd t |
| 41 |
for f in $(ls *.t) ; |
| 42 |
do |
| 43 |
perl $f |
| 44 |
done |
| 45 |
echo "Completed $2" |
| 46 |
export PERL5LIB=$PERL5LIB_ORIG |
| 47 |
exit 0 |
| 48 |
fi |
| 49 |
|
| 50 |
if [ "$2" = "BUILD_SYSTEM_INSTALL_ALL" ]; then |
| 51 |
echo Installs htslib, then builds and installs Bio::DB::HTS |
| 52 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git |
| 53 |
cd htslib |
| 54 |
sudo make install |
| 55 |
sudo ldconfig |
| 56 |
cd .. |
| 57 |
$1 |
| 58 |
cd Bio-DB-HTS |
| 59 |
perl Build.PL |
| 60 |
sudo ./Build install |
| 61 |
cd t |
| 62 |
for f in $(ls *.t) ; |
| 63 |
do |
| 64 |
perl $f |
| 65 |
done |
| 66 |
echo "Completed $2" |
| 67 |
exit 0 |
| 68 |
fi |
| 69 |
|
| 70 |
|
| 71 |
if [ "$2" = "BUILD_LOCAL_INSTALLED_HTSLIB" ]; then |
| 72 |
echo Installs htslib and Bio::DB::HTS to a local dir |
| 73 |
echo Specifies htslib dir using --prefix |
| 74 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git |
| 75 |
cd htslib |
| 76 |
make prefix=~/localsw install |
| 77 |
export HTSLIB_DIR= |
| 78 |
cd .. |
| 79 |
$1 |
| 80 |
cd Bio-DB-HTS |
| 81 |
perl Build.PL --prefix=~/localsw |
| 82 |
./Build |
| 83 |
export PERL5LIB=$PERL5LIB:$(pwd -P)/lib:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/Faidx |
| 84 |
cd t |
| 85 |
for f in $(ls *.t) ; |
| 86 |
do |
| 87 |
perl $f |
| 88 |
done |
| 89 |
echo "Completed $2" |
| 90 |
export PERL5LIB=$PERL5LIB_ORIG |
| 91 |
exit 0 |
| 92 |
fi |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
if [ "$2" = "BUILD_HTSLIB_DIR_ENV" ]; then |
| 97 |
echo Builds htslib, then runs Bio::DB::HTS Build process. Should run from this location. |
| 98 |
echo Specifies htslib location with HTSLIB_DIR environment variable |
| 99 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git |
| 100 |
cd htslib |
| 101 |
make |
| 102 |
export HTSLIB_DIR="$PWD" |
| 103 |
echo $HTSLIB_DIR |
| 104 |
cd .. |
| 105 |
$1 |
| 106 |
cd Bio-DB-HTS |
| 107 |
perl Build.PL |
| 108 |
./Build |
| 109 |
export PERL5LIB=$PERL5LIB:$(pwd -P)/lib:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/Faidx |
| 110 |
cd t |
| 111 |
for f in $(ls *.t) ; |
| 112 |
do |
| 113 |
perl $f |
| 114 |
done |
| 115 |
echo "Completed $2" |
| 116 |
export PERL5LIB=$PERL5LIB_ORIG |
| 117 |
exit 0 |
| 118 |
fi |
| 119 |
|
| 120 |
if [ "$2" = "BUILD_HTSLIB_DIR_FLAG" ]; then |
| 121 |
echo Makes htslib, then runs Bio::DB::HTS Build process |
| 122 |
echo Specifies htslib location with --htslib flag |
| 123 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git |
| 124 |
cd htslib |
| 125 |
make |
| 126 |
export HTSLIB_DIR_FOR_FLAG="$PWD" |
| 127 |
echo $HTSLIB_DIR_FOR_FLAG |
| 128 |
cd .. |
| 129 |
$1 |
| 130 |
cd Bio-DB-HTS |
| 131 |
perl Build.PL --htslib=$HTSLIB_DIR_FOR_FLAG |
| 132 |
./Build |
| 133 |
export PERL5LIB=$PERL5LIB:$(pwd -P)/lib:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/Faidx |
| 134 |
cd t |
| 135 |
for f in $(ls *.t) ; |
| 136 |
do |
| 137 |
perl $f |
| 138 |
done |
| 139 |
echo "Completed $2" |
| 140 |
export PERL5LIB=$PERL5LIB_ORIG |
| 141 |
exit 0 |
| 142 |
fi |
| 143 |
|
| 144 |
|
| 145 |
#TODO Alien::HTSlib dependency resolver |
| 146 |
#TODO pkg-config test |
| 147 |
#Test the static option using the INSTALL_STATIC_FLAG option |
| 148 |
|
| 149 |
# |
| 150 |
#test the INSTALL.pl script with various options |
| 151 |
# |
| 152 |
|
| 153 |
if [ "$2" = "INSTALL_WITH_SYSTEM_HTSLIB" ]; then |
| 154 |
echo INSTALL.pl with system install of htslib for running |
| 155 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git |
| 156 |
cd htslib |
| 157 |
sudo make install |
| 158 |
sudo ldconfig |
| 159 |
cd .. |
| 160 |
$1 |
| 161 |
cd Bio-DB-HTS |
| 162 |
perl INSTALL.pl |
| 163 |
cd t |
| 164 |
for f in $(ls *.t) ; |
| 165 |
do |
| 166 |
perl $f |
| 167 |
done |
| 168 |
echo "Completed $2" |
| 169 |
exit 0 |
| 170 |
fi |
| 171 |
|
| 172 |
if [ "$2" = "INSTALL_WITH_OTHER_HTSLIB" ]; then |
| 173 |
echo INSTALL.pl, with a htslib installed elsewhere for running |
| 174 |
export LD_LIBRARY_PATH_ORIG=$LD_LIBRARY_PATH |
| 175 |
git clone -b master --depth=1 https://github.com/samtools/htslib.git htslib_run_location |
| 176 |
cd htslib_run_location |
| 177 |
make |
| 178 |
cd .. |
| 179 |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd -P)/htslib_run_location |
| 180 |
$1 |
| 181 |
cd Bio-DB-HTS |
| 182 |
perl INSTALL.pl |
| 183 |
cd t |
| 184 |
for f in $(ls *.t) ; |
| 185 |
do |
| 186 |
perl $f |
| 187 |
done |
| 188 |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ORIG |
| 189 |
echo "Completed $2" |
| 190 |
exit 0 |
| 191 |
fi |
| 192 |
|
| 193 |
if [ "$2" = "INSTALL_PREFIX_PATH" ]; then |
| 194 |
echo INSTALL.pl with prefix at end of line |
| 195 |
$1 |
| 196 |
cd Bio-DB-HTS |
| 197 |
perl INSTALL.pl ~/prefix_path_test |
| 198 |
export PERL5LIB=$PERL5LIB:~/prefix_path_test/lib/perl5/x86_64-linux-gnu-thread-multi/:~/prefix_path_test/lib/perl5/x86_64-linux-gnu-thread-multi/auto |
| 199 |
cd t |
| 200 |
for f in $(ls *.t) ; |
| 201 |
do |
| 202 |
perl $f |
| 203 |
done |
| 204 |
echo "Completed $2" |
| 205 |
export PERL5LIB=$PERL5LIB_ORIG |
| 206 |
exit 0 |
| 207 |
fi |
| 208 |
|
| 209 |
if [ "$2" = "INSTALL_PREFIX_FLAG" ]; then |
| 210 |
echo INSTALL.pl with prefix at end of line |
| 211 |
$1 |
| 212 |
cd Bio-DB-HTS |
| 213 |
perl INSTALL.pl --prefix=~/prefix_flag_test |
| 214 |
export PERL5LIB=$PERL5LIB:~/prefix_flag_test/lib/perl5/x86_64-linux-gnu-thread-multi/:~/prefix_flag_test/lib/perl5/x86_64-linux-gnu-thread-multi/auto |
| 215 |
cd t |
| 216 |
for f in $(ls *.t) ; |
| 217 |
do |
| 218 |
perl $f |
| 219 |
done |
| 220 |
echo "Completed $2" |
| 221 |
export PERL5LIB=$PERL5LIB_ORIG |
| 222 |
exit 0 |
| 223 |
fi |
| 224 |
|
| 225 |
|
| 226 |
if [ "$2" = "INSTALL_STATIC_FLAG" ]; then |
| 227 |
echo INSTALL.pl with static option as flag |
| 228 |
$1 |
| 229 |
cd Bio-DB-HTS |
| 230 |
perl INSTALL.pl --static |
| 231 |
cd t |
| 232 |
for f in $(ls *.t) ; |
| 233 |
do |
| 234 |
perl $f |
| 235 |
done |
| 236 |
echo "Completed $2" |
| 237 |
exit 0 |
| 238 |
fi |
| 239 |
|
| 240 |
if [ "$2" = "INSTALL_HTSLIB_VERSION" ]; then |
| 241 |
echo INSTALL.pl built against a specific release of HTSlib |
| 242 |
$1 |
| 243 |
cd Bio-DB-HTS |
| 244 |
perl INSTALL.pl --htslib_version 1.3 |
| 245 |
export PERL5LIB=$PERL5LIB:$(pwd -P)/lib:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/:$(pwd -P)/blib/arch/auto/Bio/DB/HTS/Faidx |
| 246 |
cd t |
| 247 |
for f in $(ls *.t) ; |
| 248 |
do |
| 249 |
perl $f |
| 250 |
done |
| 251 |
echo "Completed $2" |
| 252 |
exit 0 |
| 253 |
fi |
| 254 |
|
| 255 |
|
| 256 |
echo Build test option $2 not found |