Skip to content

Commit

Permalink
Added tarball release as package option. Fixes #8, Fixes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewThe committed Dec 11, 2019
1 parent 48fb92a commit 236b401
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 101 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ include("CommonCMake.txt")
my_set(CMAKE_BUILD_TYPE "Debug" "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.")
#my_set(CMAKE_PREFIX_PATH "../" "Default path to packages")

option(TARBALL_BUILD "Create a tarball instead of an installer package." OFF)
if(TARBALL_BUILD)
add_definitions(-DTARBALL_BUILD) # triggers ifdef statements in the C++ code
endif(TARBALL_BUILD)

option(FINGERPRINT_FILTER "Use pre-filtering of spectrum pairs by their fragment fingerprints." OFF)
if(FINGERPRINT_FILTER)
add_definitions(-DFINGERPRINT_FILTER) # triggers ifdef statements in the C++ code
Expand Down
96 changes: 49 additions & 47 deletions CPack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,53 +62,55 @@ if(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SPECIFIC_SYSTEM_VERSION_NAME "${CMAKE_SYSTEM_NAME}")
set(CPACK_GENERATOR "TGZ")
if(EXISTS "/etc/redhat-release")
set(LINUX_NAME "")
file(READ "/etc/redhat-release" LINUX_ISSUE)
elseif(EXISTS "/etc/issue")
set(LINUX_NAME "")
file(READ "/etc/issue" LINUX_ISSUE)
endif()
if(DEFINED LINUX_ISSUE)
# Fedora case
if(LINUX_ISSUE MATCHES "Fedora")
string(REGEX MATCH "release ([0-9]+)" FEDORA "${LINUX_ISSUE}")
set(LINUX_NAME "FC${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Fedora")
# Red Hat case
if(LINUX_ISSUE MATCHES "Red")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" REDHAT "${LINUX_ISSUE}")
set(LINUX_NAME "RHEL_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Red")
# CentOS case
if(LINUX_ISSUE MATCHES "CentOS")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" CENTOS "${LINUX_ISSUE}")
set(LINUX_NAME "CentOS_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "CentOS")
# Ubuntu case
if(LINUX_ISSUE MATCHES "Ubuntu")
string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}")
set(LINUX_NAME "Ubuntu_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Ubuntu")
# Debian case
if(LINUX_ISSUE MATCHES "Debian")
string(REGEX MATCH "Debian .*ux ([a-zA-Z]*/?[a-zA-Z]*) .*" DEBIAN "${LINUX_ISSUE}")
set(LINUX_NAME "Debian_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Debian")
# Open SuSE case
if(LINUX_ISSUE MATCHES "SUSE")
string(REGEX MATCH "SUSE ([0-9]+\\.[0-9]+)" SUSE "${LINUX_ISSUE}")
set(LINUX_NAME "openSUSE_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "SUSE")
endif(DEFINED LINUX_ISSUE)
if(NOT TARBALL_BUILD)
if(EXISTS "/etc/redhat-release")
set(LINUX_NAME "")
file(READ "/etc/redhat-release" LINUX_ISSUE)
elseif(EXISTS "/etc/issue")
set(LINUX_NAME "")
file(READ "/etc/issue" LINUX_ISSUE)
endif()
if(DEFINED LINUX_ISSUE)
# Fedora case
if(LINUX_ISSUE MATCHES "Fedora")
string(REGEX MATCH "release ([0-9]+)" FEDORA "${LINUX_ISSUE}")
set(LINUX_NAME "FC${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Fedora")
# Red Hat case
if(LINUX_ISSUE MATCHES "Red")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" REDHAT "${LINUX_ISSUE}")
set(LINUX_NAME "RHEL_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Red")
# CentOS case
if(LINUX_ISSUE MATCHES "CentOS")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" CENTOS "${LINUX_ISSUE}")
set(LINUX_NAME "CentOS_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "CentOS")
# Ubuntu case
if(LINUX_ISSUE MATCHES "Ubuntu")
string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}")
set(LINUX_NAME "Ubuntu_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Ubuntu")
# Debian case
if(LINUX_ISSUE MATCHES "Debian")
string(REGEX MATCH "Debian .*ux ([a-zA-Z]*/?[a-zA-Z]*) .*" DEBIAN "${LINUX_ISSUE}")
set(LINUX_NAME "Debian_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Debian")
# Open SuSE case
if(LINUX_ISSUE MATCHES "SUSE")
string(REGEX MATCH "SUSE ([0-9]+\\.[0-9]+)" SUSE "${LINUX_ISSUE}")
set(LINUX_NAME "openSUSE_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "SUSE")
endif(DEFINED LINUX_ISSUE)
endif(NOT TARBALL_BUILD)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif(UNIX)

Expand Down
4 changes: 2 additions & 2 deletions admin/builders/install_qt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ tools_dir=$1
# change directory to the build director
cd ${tools_dir}

linux_qt=qtbase-everywhere-src-5.11.2
linux_qt=qtbase-everywhere-src-5.13.2
if [ ! -d Qt-dynamic ]; then

if [ ! -f ${linux_qt}.tar.xz ]; then
wget http://download.qt.io/official_releases/qt/5.11/5.11.2/submodules/${linux_qt}.tar.xz
wget http://download.qt.io/official_releases/qt/5.13/5.13.2/submodules/${linux_qt}.tar.xz
fi

tar xf ${linux_qt}.tar.xz
Expand Down
96 changes: 96 additions & 0 deletions admin/builders/tarball64_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash
# managing input arguments
while getopts “s:b:r:t:g” OPTION; do
case $OPTION in
s) src_dir=${OPTARG};;
t) branch=${OPTARG};;
r) release_dir=${OPTARG};;
b) build_dir=${OPTARG};;
g) no_gui=true;;
\?) echo "Invalid option: -${OPTARG}" >&2;;
esac
done

if [[ -z ${build_dir} ]]; then
build_dir="$(mktemp -d --tmpdir build_XXXX)";
fi
if [[ -z ${src_dir} ]]; then
if [[ -n ${branch} ]]; then
sudo apt-get install git;
src_dir="$(mktemp -d --tmpdir build_XXXX)";
git clone --branch "$1" https://github.com/statisticalbiotechnology/maracluster.git "${src_dir}/maracluster";
else
src_dir=$(dirname ${BASH_SOURCE})/../../../
fi
fi
if [[ -z ${release_dir} ]]; then
release_dir=${HOME}/release
fi

rm -f $build_dir/{maracluster,maracluster-gui}/mar*.tar.gz

sudo apt-get update;
sudo apt-get upgrade;
sudo apt-get -y install g++ make cmake
CMAKE_BINARY=cmake # this can be overridden if a newer version of cmake is needed

mkdir -p ${build_dir}/tools
cd ${build_dir}/tools

if [ ! -d ${build_dir}/tools/proteowizard ]; then
${src_dir}/maracluster/admin/builders/install_proteowizard.sh ${build_dir}/tools
fi

#-----MaRaCluster-GUI dependencies-------

if [ "$no_gui" != true ] ; then
# patchelf is available from Ubuntu 16.04, install from source otherwise
sudo apt -y install patchelf || missing_patchelf=true
if [ "$missing_patchelf" == true ] ; then
if [ ! -d ${build_dir}/tools/patchelf-0.8 ]; then
wget http://nixos.org/releases/patchelf/patchelf-0.8/patchelf-0.8.tar.bz2
tar xf patchelf-0.8.tar.bz2
cd patchelf-0.8/
./configure --prefix="${build_dir}/tools"
make install
fi
patchelf_binary=${build_dir}/tools/bin/patchelf
else
patchelf_binary=patchelf
fi

sudo apt -y install libgl1-mesa-dev libicu-dev libfreetype6-dev

source ${src_dir}/maracluster/admin/builders/install_qt.sh ${build_dir}/tools
fi

mkdir -p $build_dir/maracluster
#-----cmake-----
cd $build_dir/maracluster;
echo -n "cmake maracluster.....";
${CMAKE_BINARY} -DTARGET_ARCH=amd64 -DCMAKE_BUILD_TYPE=Release -DTARBALL_BUILD=ON -DCMAKE_INSTALL_PREFIX="" -DCMAKE_PREFIX_PATH=$build_dir/tools $src_dir/maracluster;
#-----make------
echo -n "make maracluster (this will take few minutes).....";
make -j 4;
make -j 4 package;

mkdir -p $release_dir
cp -v $build_dir/maracluster/mar*.tar.gz $release_dir

if [ "$no_gui" != true ] ; then
#######maracluster-gui########
mkdir -p $build_dir/maracluster-gui
cd $build_dir/maracluster-gui
#-----cmake-----
echo -n "cmake maracluster-gui.....";
${CMAKE_BINARY} -DTARGET_ARCH=amd64 -DCMAKE_BUILD_TYPE=Release -DTARBALL_BUILD=ON -DCMAKE_INSTALL_PREFIX="" -DCMAKE_PREFIX_PATH="$build_dir/tools/;$build_dir/tools/Qt-dynamic/" $src_dir/maracluster/src/qt-gui;

#-----make------
echo -n "make maracluster-gui (this will take few minutes).....";

make -j 4;
make -j 4 package;

cp -v $build_dir/maracluster-gui/mar*.tar.gz $release_dir
fi

5 changes: 3 additions & 2 deletions admin/vagrant/batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ platforms=()
#platforms+=(win64)
#platforms+=(win32)
#platforms+=(centos)
platforms+=(fedora)
platforms+=(ubuntu)
#platforms+=(fedora)
#platforms+=(ubuntu)
platforms+=(tarball)

for platform in ${platforms[@]}; do
echo "Building $platform binaries"
Expand Down
6 changes: 6 additions & 0 deletions admin/vagrant/manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ while getopts “hab:s:r:p:” OPTION; do
s) src=$OPTARG;;
r) release=$OPTARG;;
p) case $OPTARG in
tarball)
post="tarball64"
vagbox_name="ubuntu/trusty64"
vagbox_url=""
package_ext="tar.gz"
;;
ubuntu)
post="ubuntu64"
vagbox_name="ubuntu/trusty64"
Expand Down
5 changes: 4 additions & 1 deletion quickbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ EOF
}

skip_gui=""
while getopts “hs:b:r:p:” OPTION; do
while getopts “hs:b:r:p:g” OPTION; do
case $OPTION in
h) usage;exit 1;;
s) src_dir=$OPTARG;;
b) build_dir=$OPTARG;;
r) release_dir=$OPTARG;;
g) skip_gui="-g";;
p) case $OPTARG in
tarball)
post="tarball64"
;;
ubuntu)
post="ubuntu64"
;;
Expand Down
6 changes: 4 additions & 2 deletions src/qt-gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ elseif (UNIX)
find_package(ICU REQUIRED COMPONENTS uc i18n data)
find_package(Freetype REQUIRED)
find_library(STDCPP_LIBRARY NAMES libstdc++.so.6 )
find_library(PCRE2_16_LIBRARY NAMES libpcre2-16.so )
find_library(PNG_12_LIBRARY NAMES libpng12.so.0 )

set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BACKUP})

Expand All @@ -124,7 +126,7 @@ elseif (UNIX)
_qt5_get_shared_library(Gui)
_qt5_get_shared_library(DBus)

foreach (LIBRARY ${ICU_LIBRARIES} ${FREETYPE_LIBRARIES} ${QtXcbQpa_LIBRARY_FULL} ${STDCPP_LIBRARY})
foreach (LIBRARY ${ICU_LIBRARIES} ${FREETYPE_LIBRARIES} ${QtXcbQpa_LIBRARY_FULL} ${STDCPP_LIBRARY} ${PCRE2_16_LIBRARY} ${PNG_12_LIBRARY})
get_filename_component(LIBRARY_RESOLVED ${LIBRARY} REALPATH)
list(APPEND LIBRARIES_RESOLVED ${LIBRARY_RESOLVED})
string(REGEX REPLACE "(.*\\.so.[0-9]+).*" "\\1" LIBRARY_MAIN_VERSION "${LIBRARY_RESOLVED}")
Expand All @@ -144,7 +146,7 @@ elseif (UNIX)
find_program (PATCHELF_BINARY NAMES patchelf)
message( STATUS "Found patchelf binary: ${PATCHELF_BINARY}")
install(CODE "execute_process(COMMAND ${PATCHELF_BINARY} --remove-rpath ${QtXcbPlugin_copied_location})") # gives "stat: No such file or directory" error on earlier versions of patchelf. This can be ignored.
install(CODE "execute_process(COMMAND ${PATCHELF_BINARY} --force-rpath --set-rpath '$ORIGIN/..' ${QtXcbPlugin_copied_location})")
install(CODE "execute_process(COMMAND ${PATCHELF_BINARY} --force-rpath --set-rpath $ORIGIN/.. ${QtXcbPlugin_copied_location})")

install(PROGRAMS ${QtXcbPlugin_copied_location} DESTINATION lib/maracluster/platforms)

Expand Down
96 changes: 49 additions & 47 deletions src/qt-gui/CPack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,53 +44,55 @@ if(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SPECIFIC_SYSTEM_VERSION_NAME "${CMAKE_SYSTEM_NAME}")
set(CPACK_GENERATOR "TGZ")
if(EXISTS "/etc/redhat-release")
set(LINUX_NAME "")
file(READ "/etc/redhat-release" LINUX_ISSUE)
elseif(EXISTS "/etc/issue")
set(LINUX_NAME "")
file(READ "/etc/issue" LINUX_ISSUE)
endif()
if(DEFINED LINUX_ISSUE)
# Fedora case
if(LINUX_ISSUE MATCHES "Fedora")
string(REGEX MATCH "release ([0-9]+)" FEDORA "${LINUX_ISSUE}")
set(LINUX_NAME "FC${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Fedora")
# Red Hat case
if(LINUX_ISSUE MATCHES "Red")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" REDHAT "${LINUX_ISSUE}")
set(LINUX_NAME "RHEL_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Red")
# CentOS case
if(LINUX_ISSUE MATCHES "CentOS")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" CENTOS "${LINUX_ISSUE}")
set(LINUX_NAME "CentOS_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "CentOS")
# Ubuntu case
if(LINUX_ISSUE MATCHES "Ubuntu")
string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}")
set(LINUX_NAME "Ubuntu_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Ubuntu")
# Debian case
if(LINUX_ISSUE MATCHES "Debian")
string(REGEX MATCH "Debian .*ux ([a-zA-Z]*/?[a-zA-Z]*) .*" DEBIAN "${LINUX_ISSUE}")
set(LINUX_NAME "Debian_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Debian")
# Open SuSE case
if(LINUX_ISSUE MATCHES "SUSE")
string(REGEX MATCH "SUSE ([0-9]+\\.[0-9]+)" SUSE "${LINUX_ISSUE}")
set(LINUX_NAME "openSUSE_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "SUSE")
endif(DEFINED LINUX_ISSUE)
if(NOT TARBALL_BUILD)
if(EXISTS "/etc/redhat-release")
set(LINUX_NAME "")
file(READ "/etc/redhat-release" LINUX_ISSUE)
elseif(EXISTS "/etc/issue")
set(LINUX_NAME "")
file(READ "/etc/issue" LINUX_ISSUE)
endif()
if(DEFINED LINUX_ISSUE)
# Fedora case
if(LINUX_ISSUE MATCHES "Fedora")
string(REGEX MATCH "release ([0-9]+)" FEDORA "${LINUX_ISSUE}")
set(LINUX_NAME "FC${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Fedora")
# Red Hat case
if(LINUX_ISSUE MATCHES "Red")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" REDHAT "${LINUX_ISSUE}")
set(LINUX_NAME "RHEL_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "Red")
# CentOS case
if(LINUX_ISSUE MATCHES "CentOS")
string(REGEX MATCH "release ([0-9]+\\.[0-9]+)" CENTOS "${LINUX_ISSUE}")
set(LINUX_NAME "CentOS_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "CentOS")
# Ubuntu case
if(LINUX_ISSUE MATCHES "Ubuntu")
string(REGEX MATCH "buntu ([0-9]+\\.[0-9]+)" UBUNTU "${LINUX_ISSUE}")
set(LINUX_NAME "Ubuntu_${CMAKE_MATCH_1}")
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Ubuntu")
# Debian case
if(LINUX_ISSUE MATCHES "Debian")
string(REGEX MATCH "Debian .*ux ([a-zA-Z]*/?[a-zA-Z]*) .*" DEBIAN "${LINUX_ISSUE}")
set(LINUX_NAME "Debian_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "DEB")
endif(LINUX_ISSUE MATCHES "Debian")
# Open SuSE case
if(LINUX_ISSUE MATCHES "SUSE")
string(REGEX MATCH "SUSE ([0-9]+\\.[0-9]+)" SUSE "${LINUX_ISSUE}")
set(LINUX_NAME "openSUSE_${CMAKE_MATCH_1}")
string(REPLACE "/" "_" LINUX_NAME ${LINUX_NAME})
set(CPACK_GENERATOR "RPM")
endif(LINUX_ISSUE MATCHES "SUSE")
endif(DEFINED LINUX_ISSUE)
endif(NOT TARBALL_BUILD)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif(UNIX)

Expand Down

0 comments on commit 236b401

Please sign in to comment.