diff --git a/quickrank/defaults/main.yml b/quickrank/defaults/main.yml new file mode 100644 index 00000000..187fe0d3 --- /dev/null +++ b/quickrank/defaults/main.yml @@ -0,0 +1,12 @@ +--- +quickrank_install: False + +quickrank_git_url: 'https://github.com/hpclab/quickrank' +quickrank_package_list: + - gcc-5 + - g++-5 + - libboost1.55-all-dev + - git + - python-software-properties + - cmake + diff --git a/quickrank/files/CMakeLists.txt.12.04.diff b/quickrank/files/CMakeLists.txt.12.04.diff new file mode 100644 index 00000000..5e67b611 --- /dev/null +++ b/quickrank/files/CMakeLists.txt.12.04.diff @@ -0,0 +1,12 @@ +--- CMakeLists.txt.orig 2016-09-22 19:35:27.516886715 +0200 ++++ CMakeLists.txt 2016-09-22 19:36:44.171131969 +0200 +@@ -2,7 +2,8 @@ + # GNU C++ COMPILER OPTION (on Mac OS X, brew): -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-5 + # BUILD TYPE: -DCMAKE_BUILD_TYPE=[Release|Debug] + +-cmake_minimum_required(VERSION 2.8.12) ++cmake_minimum_required(VERSION 2.8.7) ++set(CMAKE_USER_MAKE_RULES_OVERRIDE "QuickRankMakeRulesOverwrite.cmake") + project(QUICKRANK CXX) + + # require support of C++11 diff --git a/quickrank/files/QuickRankMakeRulesOverwrite.cmake b/quickrank/files/QuickRankMakeRulesOverwrite.cmake new file mode 100644 index 00000000..e1d6095b --- /dev/null +++ b/quickrank/files/QuickRankMakeRulesOverwrite.cmake @@ -0,0 +1 @@ +list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS c) diff --git a/quickrank/tasks/main.yml b/quickrank/tasks/main.yml new file mode 100644 index 00000000..828aec0d --- /dev/null +++ b/quickrank/tasks/main.yml @@ -0,0 +1,43 @@ +--- +- block: + - name: Add the boost ppa + apt_repository: repo='ppa:boost-latest/ppa' update_cache=yes + when: is_precise + + - name: Add the devel chain ppa + apt_repository: repo='ppa:ubuntu-toolchain-r/test' update_cache=yes + + - name: Install the quickrank dependencies + apt: name={{ item }} state=present + with_items: '{{ quickrank_package_list | default([]) }}' + + tags: [ 'boost', 'libboost', 'quickrank' ] + +- block: + - name: Download the quickrank distribution + git: repo={{ quickrank_git_url }} dest=/home/{{ d4science_user }}/quickrank + register: quickrank_src + + - name: Copy some needed files if the distribution is Ubuntu 12.04 + copy: src={{ item }} dest=/home/{{ d4science_user }}/quickrank/{{ item }} + with_items: + - CMakeLists.txt.12.04.diff + - QuickRankMakeRulesOverwrite.cmake + when: is_precise + + - name: Apply a patch to the CMakeLists.txt if the distribution is Ubuntu 12.04 + shell: cd /home/{{ d4science_user }}/quickrank ; patch -p0 < CMakeLists.txt.12.04.diff + when: is_precise + + - name: Configure the sources and compile them + shell: cd /home/{{ d4science_user }}/quickrank ; rm -fr build ; mkdir build ; cd /home/{{ d4science_user }}/quickrank/build ; cmake .. -DCMAKE_CXX_COMPILER=g++-5 -DCMAKE_BUILD_TYPE=Release ; make + when: ( quickrank_src | changed ) + + - name: Install the quickrank binaries + become: False + shell: cd /home/{{ d4science_user }}/quickrank/bin ; install -m 755 quicklearn /usr/local/bin + when: ( quickrank_src | changed ) + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'boost', 'libboost', 'quickrank', 'quickrank_bin' ]