main.yml 1.99 KB
Newer Older
julian.gethmann's avatar
julian.gethmann committed
1 2 3 4 5 6 7
---
# Install Sofia Kostoglou's (CERN) C++/Python 2.7 NAFF implementation

- name: install boost
  become: yes
  dnf:
    name: "{{ item }}"
julian.gethmann's avatar
julian.gethmann committed
8
    state: present
julian.gethmann's avatar
julian.gethmann committed
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
  with_items:
    - boost-devel
    #  boost
    #  boost-container
    #  boost-context
    #  boost-coroutine
    #  boost-devel
    #  boost-graph
    #  boost-locale
    #  boost-log
    #  boost-math
    #  boost-program-options
    #  boost-python
    #  boost-random
    #  boost-regex
    #  boost-serialization
    #  boost-signals
    #  boost-test
    #  boost-timer
    #  boost-type_erasure
    #  boost-wave
    #  libicu-devel
    - fftw-devel
    # fftw
    # fftw-libs
    # fftw-libs-long
    # fftw-libs-quad
    - cmake
  when: ansible_distribution == 'Fedora'

- name: test if NAFF is installed
  command: python -c "import NAFF"
  register: not_there
  ignore_errors: True
  changed_when: not_there.rc == 1

- name: clone git
  git:
    repo: https://github.com/skostogl/NAFF_cpp.git
    version: master
    dest: /tmp/NAFF_cpp
    clone: yes
    depth: 1
  when: not_there.rc == 1

54 55 56 57 58 59 60
- name: create build dir
  become: yes
  file:
    path: /tmp/NAFF_cpp/build
    mode: 0777
    state: directory

julian.gethmann's avatar
julian.gethmann committed
61 62 63
- name: patch CMake file 1/2
  become: yes
  lineinfile:
julian.gethmann's avatar
julian.gethmann committed
64 65
    line: "add_library(NAFF SHARED interface_NAFF.cpp ${SOURCE_FILES} ${HEADER_FILES})"
    regexp: "add_library.*"
julian.gethmann's avatar
julian.gethmann committed
66 67 68 69 70
    path: /tmp/NAFF_cpp/CMakeLists.txt

- name: patch CMake file 2/2
  become: yes
  lineinfile:
julian.gethmann's avatar
julian.gethmann committed
71 72
    line: "# add_executable (NAFF main_NAFF.cpp ${SOURCE_FILES} ${HEADER_FILES})"
    regexp: "add_executable.*"
julian.gethmann's avatar
julian.gethmann committed
73 74
    path: /tmp/NAFF_cpp/CMakeLists.txt
    
julian.gethmann's avatar
julian.gethmann committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
- name: build
  command: cmake ..
  args:
    chdir: /tmp/NAFF_cpp/build
    creates: /tmp/NAFF_cpp/build/Makefile
  when: not_there.rc == 1

- name: make
  make:
    chdir: /tmp/NAFF_cpp/build
  when: not_there.rc == 1

- name: copy shared object to Python's path
  become: yes
  copy:
    src: /tmp/NAFF_cpp/NAFF.so
    dest: /usr/lib/python2.7/site-packages/NAFF.so
    backup: yes
    remote_src: True
  when: not_there.rc == 1