name: zano # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '1.1.5' # just for humans, typically '1.2+git' or '1.3.2'
summary: "Zano coin: official wallet. Secure. Scalable. Easy to Use."
description: |
  Zano is a scalable and secure coin, designed for use in e-commerce.
  The technology behind our blockchain provides reliability, security,
  and flexibility — a perfect option for P2P transactions.
  More info: http://zano.org
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  libboost:
    plugin: dump
    source: .

    override-pull: |
      curl https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2 -OL &&\
      echo '7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 boost_1_68_0.tar.bz2' | sha256sum -c - &&\
      pwd && echo pulled ok

    override-build: |
      tar -xjf $SNAPCRAFT_PART_SRC/boost_1_68_0.tar.bz2
      cd boost_1_68_0
      pwd
      ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer
      ./b2
      mkdir -p $SNAPCRAFT_PART_INSTALL/boost_1_68_0 $SNAPCRAFT_PART_INSTALL/boost_1_68_0/stage
      cp -pr boost     $SNAPCRAFT_PART_INSTALL/boost_1_68_0/
      cp -pr stage/lib $SNAPCRAFT_PART_INSTALL/boost_1_68_0/stage/

    build-packages:
      - curl
      - build-essential
      - g++
      - libicu-dev

    stage-packages:
      - libicu60

  qt:
    plugin: dump
    source: .
    override-pull: |
      curl https://download.qt.io/archive/qt/5.13/5.13.2/single/qt-everywhere-src-5.13.2.tar.xz -OL &&\
      echo '55e8273536be41f4f63064a79e552a22133848bb419400b6fa8e9fc0dc05de08 qt-everywhere-src-5.13.2.tar.xz' | sha256sum -c - &&\
      pwd && echo pulled ok

    override-build: |
      tar -xJf $SNAPCRAFT_PART_SRC/qt-everywhere-src-5.13.2.tar.xz
      cd qt-everywhere-src-5.13.2
      pwd
      ./configure -platform linux-g++ -prefix $SNAPCRAFT_PART_INSTALL/qt5132 -opensource -confirm-license -xcb -nomake examples -nomake tests -feature-webengine-embedded-build -feature-webengine-pepper-plugins -feature-webengine-printing-and-pdf -feature-webengine-proprietary-codecs -feature-webengine-spellchecker -feature-webengine-v8-snapshot -feature-webengine-webrtc -feature-thread -xkbcommon -no-feature-d3d12 -no-feature-qt3d-animation -no-feature-qt3d-extras -no-feature-qt3d-input -no-feature-qt3d-logic -no-feature-qt3d-opengl-renderer -no-feature-qt3d-render -no-feature-qt3d-simd-avx2 -no-feature-qt3d-simd-sse2 -no-feature-gestures
      make
      make install
      echo Qt was successfully built

    build-packages:
      - g++
      - libicu-dev
      - bison
      - build-essential
      - flex
      - gperf
      - gyp
      - libasound2-dev
      - libavcodec-dev
      - libavformat-dev
      - libavutil-dev
      - libbz2-dev
      - libcap-dev
      - libcups2-dev
      - libdrm-dev
      - libegl1-mesa-dev
      - libevent-dev
      - libfontconfig1-dev
      - libgcrypt11-dev
      - libjsoncpp-dev
      - libminizip-dev
      - libnss3-dev
      - libopus-dev
      - libpci-dev
      - libpulse-dev
      - libsrtp0-dev
      - libssl-dev
      - libudev-dev
      - libwebp-dev
      - libxcb1
      - libxcb1-dev
      - libxcomposite-dev
      - libxcursor-dev
      - libxdamage-dev
      - libxkbcommon-dev
      - libxrandr-dev
      - libxss-dev
      - libxtst-dev
      - ninja-build
      - python
      - ruby
      
  zano-bin:
    after: [ libboost, qt ]
    source: https://github.com/hyle-team/zano.git
    plugin: cmake

    override-build: |
      cmake -DCMAKE_PREFIX_PATH=$SNAPCRAFT_PART_INSTALL/qt5132 -DBOOST_ROOT=$SNAPCRAFT_STAGE/boost_1_68_0 -DBOOST_LIBRARYDIR=$SNAPCRAFT_STAGE/boost_1_68_0/stage/lib -DSTATIC=True -DBUILD_GUI=True $SNAPCRAFT_PART_SRC
      make -j1 Zano
      #daemon simplewallet      
      #      cp src/zanod $SNAPCRAFT_PART_INSTALL
      #      cp src/simplewallet $SNAPCRAFT_PART_INSTALL
      pwd
      echo CLI Zano binaries built
      
      
    build-packages:
      - build-essential
      - g++
      - libicu-dev


apps:
  zano:
    command: pwd
