123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- IF(CMAKE_BINARY_DIR)
- MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
- ENDIF(CMAKE_BINARY_DIR)
-
- IF(NOT UNIX)
- MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
- ENDIF(NOT UNIX)
-
-
-
-
-
-
-
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_NAME)
- STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME)
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
- IF(NOT CPACK_PACKAGE_VERSION)
- MESSAGE(FATAL_ERROR "Debian package requires a package version")
- ENDIF(NOT CPACK_PACKAGE_VERSION)
- SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
-
-
- FIND_PROGRAM(DPKG_CMD dpkg)
- IF(NOT DPKG_CMD)
- MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
- SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
- ENDIF(NOT DPKG_CMD)
- EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
- OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
-
-
-
-
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
- MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
- IF(NOT CPACK_PACKAGE_CONTACT)
- MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
- ENDIF(NOT CPACK_PACKAGE_CONTACT)
- SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
- IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
- ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
- SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
- SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
-
-
- IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
- SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
- ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- FIND_PROGRAM(OPKG_CMD opkg-build)
- if( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
- message("CPack: opkg-build not found. Skipping packaging")
- else( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
- SET(CPACK_OPKG_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
- FILE(MAKE_DIRECTORY ${CPACK_OPKG_ROOTDIR}/CONTROL)
- set(CPACK_OPKG_CONTROL_FILE "${CPACK_OPKG_ROOTDIR}/CONTROL/control")
-
- FILE(WRITE ${CPACK_OPKG_CONTROL_FILE}
- "Package: ${CPACK_PACKAGE_NAME}
- Version: ${CPACK_PACKAGE_VERSION}
- Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
- Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}
- Section: ${CPACK_DEBIAN_PACKAGE_SECTION}
- Priority: optional
- Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER}
- Depends: ${CPACK_DEBIAN_PACKAGE_DEPENDS}
- Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES}
- Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES}
- Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS}
- Source: https://github.com/intel-iot-devkit/upm
- #Essential: no
- ")
-
- set(OPKG_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
- execute_process(
- COMMAND "${OPKG_CMD}" "-o" "0" "${CPACK_PACKAGE_FILE_NAME}" "."
- RESULT_VARIABLE _result
- OUTPUT_VARIABLE _res_output
- ERROR_VARIABLE _res_error
- WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}
- )
-
- if(${_result})
- message("Result '${_result}'")
- message("Output '${_res_output}'")
- message("Error '${_res_error}'")
- else(${_result})
- message("CPack: Package ${OPKG_FILE_NAME}.ipk generated.")
- set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
- file(RENAME ${CPACK_TOPLEVEL_DIRECTORY}/${OPKG_FILE_NAME}.ipk ${CPACK_BINARY_DIR}/${OPKG_FILE_NAME}.ipk)
- endif(${_result})
- endif( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
|