forked from pol/tacc-sci-life
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstacks-1.29-1.spec
159 lines (132 loc) · 4.88 KB
/
stacks-1.29-1.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
Name: stacks
Version: 1.29
Release: 1
License: GPLv3
Vendor: Cresko Lab at U Oregon
Group: Applications/Life Sciences
Source0: http://creskolab.uoregon.edu/stacks/source/stacks-1.29.tar.gz
Source1: http://sourceforge.net/projects/samtools/files/samtools/0.1.19/samtools-0.1.19.tar.bz2
Packager: TACC - [email protected]
Summary: Stacks - short-read genomics pipeline
Prefix: /opt/apps
# build with:
# build_rpm.sh --gcc=47 stacks-1.29-1.spec
# build_rpm.sh --intel=15 stacks-1.29-1.spec
#------------------------------------------------
# INITIAL DEFINITIONS
#------------------------------------------------
## System Definitions
%include ./include/system-defines.inc
%include ./include/%{PLATFORM}/rpm-dir.inc
## Compiler Family Definitions
%include ./include/%{PLATFORM}/compiler-defines.inc
## MPI Family Definitions
# %include ./include/%{PLATFORM}/mpi-defines.inc
%define INSTALL_DIR %{APPS}/%{comp_fam_ver}/%{name}/%{version}
%define MODULE_DIR %{APPS}/%{comp_fam_ver}/%{MODULES}/%{name}
%define MODULE_VAR %{MODULE_VAR_PREFIX}STACKS
%define PNAME stacks
%package -n %{name}-%{comp_fam_ver}
Summary: Stacks - short-read genomics pipeline
Group: Applications/Life Sciences
%description
%description -n %{name}-%{comp_fam_ver}
Stacks is a software pipeline for building loci from short-read sequences, such as those generated on the Illumina platform.
## PREP
# Use -n <name> if source file different from <name>-<version>.tar.gz
%prep
rm -rf $RPM_BUILD_ROOT/%{INSTALL_DIR}
## SETUP
%setup -n %{name}-%{version}
# The next command unpacks Source1
# -b <n> means unpack the nth source *before* changing directories.
# -a <n> means unpack the nth source *after* changing to the
# top-level build directory (i.e. as a subdirectory of the main source).
# -T prevents the 'default' source file from re-unpacking. If you don't have this, the
# default source will unpack twice... a weird RPMism.
# -D prevents the top-level directory from being deleted before we can get there!
%setup -T -D -a 1
## BUILD
%build
#------------------------------------------------
# INSTALL
#------------------------------------------------
%install
# Start with a clean environment
%include ./include/%{PLATFORM}/system-load.inc
mkdir -p $RPM_BUILD_ROOT/%{INSTALL_DIR}
#------------------------------------------------
## Install Steps Start
module purge
module load TACC
# won't build under intel 13
%include ./include/compiler-load.inc
mv samtools* samtools
cd samtools
MY_SAMTOOLS_DIR=$PWD
make
cd ..
./configure CC=$CC CXX=$CXX --prefix=%{INSTALL_DIR} --enable-bam --with-bam-include-path=$MY_SAMTOOLS_DIR --with-bam-lib-path=$MY_SAMTOOLS_DIR
if [ -n "$GCC_LIB" ]; then
make CC=$CC CXX=$CXX LDFLAGS="-Wl,-rpath,$GCC_LIB"
make CC=$CC CXX=$CXX DESTDIR=$RPM_BUILD_ROOT LDFLAGS="-Wl,-rpath,$GCC_LIB" install
else
make CC=$CC CXX=$CXX
make CC=$CC CXX=$CXX DESTDIR=$RPM_BUILD_ROOT install
fi
cp LICENSE README ChangeLog $RPM_BUILD_ROOT/%{INSTALL_DIR}
mkdir $RPM_BUILD_ROOT/%{INSTALL_DIR}/samtools
cp -R ./samtools*/{samtools,bcftools,misc,libbam.a,*.h} $RPM_BUILD_ROOT/%{INSTALL_DIR}/samtools
## Install Steps End
#------------------------------------------------
#------------------------------------------------
# MODULEFILE CREATION
#------------------------------------------------
rm -rf $RPM_BUILD_ROOT/%{MODULE_DIR}
mkdir -p $RPM_BUILD_ROOT/%{MODULE_DIR}
#------------------------------------------------
## Modulefile Start
cat > $RPM_BUILD_ROOT/%{MODULE_DIR}/%{version}.lua << 'EOF'
help (
[[
This module loads %{PNAME} built with icc.
Documentation for %{PNAME} is available online at http://creskolab.uoregon.edu/stacks/
The stacks executable can be found in %{MODULE_VAR}_BIN
Version %{version}
]])
whatis("Name: %{PNAME}")
whatis("Version: %{version}")
whatis("Category: computational biology, genomics")
whatis("Keywords: Biology, Genomics, Alignment, Sequencing")
whatis("Description: Stacks - short-read genomics pipeline")
whatis("URL: http://creskolab.uoregon.edu/stacks/")
setenv("%{MODULE_VAR}_DIR","%{INSTALL_DIR}/")
setenv("%{MODULE_VAR}_BIN","%{INSTALL_DIR}/bin/")
append_path("PATH" ,"%{INSTALL_DIR}/bin")
EOF
## Modulefile End
#------------------------------------------------
## Lua syntax check
if [ -f $SPEC_DIR/checkModuleSyntax ]; then
$SPEC_DIR/checkModuleSyntax $RPM_BUILD_ROOT/%{MODULE_DIR}/%{version}.lua
fi
## VERSION FILE
cat > $RPM_BUILD_ROOT%{MODULE_DIR}/.version.%{version} << 'EOF'
#%Module3.1.1#################################################
##
## version file for %{PNAME}-%{version}
##
set ModulesVersion "%{version}"
EOF
#------------------------------------------------
# FILES SECTION
#------------------------------------------------
%files -n %{name}-%{comp_fam_ver}
# Define files permisions, user and group
%defattr(755,root,root,-)
%{INSTALL_DIR}
%{MODULE_DIR}
## CLEAN UP
%post -n %{name}-%{comp_fam_ver}
%clean
rm -rf $RPM_BUILD_ROOT