snapcraft.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. name: ozwdaemon
  2. base: core20
  3. adopt-info: set-version
  4. summary: "QT Wrapper for OpenZWave. Remotely manage a Z-Wave Network."
  5. description: |
  6. A dedicated snap package that contains only the ozwdaemon service.
  7. This snap contains only the ozwdaemon application and none of the management tools. Use Home Assistant or OZW Admin to connect to it.
  8. NOTE! To add secure devices through Home Assistant, you have to make service calls, with the payload:
  9. {
  10. "secure": true,
  11. "instance_id": <id given in configuration>
  12. }
  13. This is an issue with the OpenZWave integration of Home Assistant and will hopefully be fixed in the future.
  14. See `snap get ozwdaemon -d` for configuration options.
  15. grade: devel
  16. confinement: strict
  17. layout:
  18. /usr/local/share/OpenZWave/qt-openzwavedatabase.rcc:
  19. bind-file: $SNAP/usr/share/qt5/qt-openzwavedatabase.rcc
  20. apps:
  21. ozwdaemon:
  22. daemon: simple
  23. restart-condition: on-failure
  24. command: usr/local/bin/ozwdaemon
  25. command-chain:
  26. - bin/env-wrapper
  27. plugs:
  28. - network
  29. - network-bind
  30. - raw-usb
  31. exec:
  32. command: usr/local/bin/ozwdaemon
  33. command-chain:
  34. - bin/env-wrapper
  35. plugs:
  36. - network
  37. - network-bind
  38. - raw-usb
  39. parts:
  40. open-zwave:
  41. plugin: make
  42. source: https://github.com/OpenZWave/open-zwave.git
  43. qtmqtt:
  44. after: [open-zwave]
  45. plugin: make # aka qmake
  46. source: https://github.com/qt/qtmqtt.git
  47. source-tag: 5.12.8
  48. build-packages:
  49. - build-essential
  50. - qt5-default
  51. - qtbase5-private-dev
  52. override-build: |
  53. if [ -f "Makefile" ]; then
  54. echo "Clean $SNAPCRAFT_PART_BUILD"
  55. qmake -r
  56. make distclean
  57. fi
  58. qmake
  59. make -j$(nproc)
  60. make -j$(nproc) install
  61. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  62. override-prime: |
  63. snapcraftctl prime
  64. stage-packages:
  65. - libdouble-conversion3
  66. - libfreetype6
  67. - libgl1
  68. - libglvnd0
  69. - libglx0
  70. - libgraphite2-3
  71. - libharfbuzz0b
  72. - libicu66
  73. - libpcre2-16-0
  74. - libpng16-16
  75. - libqt5core5a
  76. - libqt5gui5
  77. - libqt5network5
  78. - libqt5websockets5
  79. - libqt5widgets5
  80. - libx11-6
  81. - libxau6
  82. - libxcb1
  83. - libxdmcp6
  84. qt-openzwave:
  85. after: [open-zwave, qtmqtt]
  86. plugin: make # aka qmake?
  87. source: https://github.com/OpenZWave/qt-openzwave.git
  88. build-packages:
  89. - build-essential
  90. - qt5-default
  91. - libqt5websockets5-dev
  92. - libqt5remoteobjects5-dev
  93. - libqt5remoteobjects5-bin
  94. - gcc-8-base
  95. - libgcc-8-dev
  96. - cmake
  97. - pkgconf
  98. - libunwind-dev
  99. - libcurl4-openssl-dev
  100. - rapidjson-dev
  101. stage-packages:
  102. - libdouble-conversion3
  103. - libicu66
  104. - libpcre2-16-0
  105. - libqt5core5a
  106. - libqt5network5
  107. - libqt5remoteobjects5
  108. - libqt5websockets5
  109. - libunwind8
  110. override-build: |
  111. if [ -f "Makefile" ]; then
  112. echo "Clean $SNAPCRAFT_PART_BUILD"
  113. qmake -r
  114. make distclean
  115. fi
  116. INSTALL_PATH="${HOME}"
  117. if [ ! -z ${container+x} ]; then
  118. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  119. fi
  120. OZW_LIB_PATH="$(dirname $(find ${INSTALL_PATH}/parts/open-zwave/install -name libopenzwave.so -print0 -quit))"
  121. OZW_INCLUDE_PATH="$(dirname $(find ${INSTALL_PATH}/parts/open-zwave/install -name Manager.h -print0 -quit))"
  122. OZW_DATABASE_PATH="$(dirname $(find ${INSTALL_PATH}/parts/open-zwave/install -name manufacturer_specific.xml))"
  123. qmake -r "CONFIG+=release" \
  124. OZW_LIB_PATH="${OZW_LIB_PATH}" \
  125. OZW_INCLUDE_PATH="${OZW_INCLUDE_PATH}" \
  126. OZW_DATABASE_PATH="${OZW_DATABASE_PATH}"
  127. make -j$(nproc)
  128. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  129. local-src:
  130. after: [qt-openzwave]
  131. plugin: dump
  132. source: ./src
  133. source-type: local
  134. stage-packages:
  135. - coreutils
  136. - netcat-openbsd
  137. organize:
  138. hooks: snap/hooks
  139. set-version:
  140. after: [qt-openzwave]
  141. plugin: nil
  142. override-build: |
  143. set -ex
  144. INSTALL_PATH="${HOME}"
  145. if [ ! -z ${container+x} ]; then
  146. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  147. fi
  148. LIBQT_OZW=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwave.so.1 -print -quit)")
  149. LIB_OZW=$(dirname "$(find ${INSTALL_PATH} -name libopenzwave.so* -print -quit)")
  150. LIB_OZWDB=$(dirname "$(find ${INSTALL_ROOT} -name libqt-openzwavedatabase.so.1 -print -quit)")
  151. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBQT_OZW:$LIB_OZW:$LIB_OZWDB
  152. OZWD=$(find ${INSTALL_PATH} -type f -name ozwdaemon -print -quit)
  153. VERSION=$($OZWD --version | cut -f2 -d ' ')
  154. snapcraftctl set-version "${VERSION}"