snapcraft.yaml 4.9 KB

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