diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d5a03170..f648843a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,14 @@ install(TARGETS st-flash st-info RUNTIME DESTINATION bin ) +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + file(GLOB RULES_FILES etc/udev/rules.d/*.rules) + install(FILES etc/modprobe.d/stlink_v1.conf + DESTINATION /etc) + install(FILES ${RULES_FILES} + DESTINATION /lib/udev/rules.d/) +endif() + add_subdirectory(src/gdbserver) add_subdirectory(src/tools/gui) diff --git a/Makefile b/Makefile index fca19d603..2ddfceee8 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,10 @@ release: build/Release @echo "[RELEASE]" @$(MAKE) -C build/Release +package: build/Release + @echo "[PACKAGE] Release" + @$(MAKE) -C build/Release package + test: debug @$(MAKE) -C build/Debug test diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake index 4e851efae..1dfd376be 100644 --- a/cmake/CPackConfig.cmake +++ b/cmake/CPackConfig.cmake @@ -3,6 +3,8 @@ set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set (CPACK_SOURCE_GENERATOR "TBZ2;ZIP") set (CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}") set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") +set (CPACK_SET_DESTDIR "ON") +set (CPACK_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/cpack/staging") if (APPLE) set(CPACK_GENERATOR "ZIP") file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/dist/osx") diff --git a/debian/libstlink-dev.install b/debian/libstlink-dev.install index 1eff3299c..0c3543cd9 100644 --- a/debian/libstlink-dev.install +++ b/debian/libstlink-dev.install @@ -1,3 +1,5 @@ usr/include/* usr/lib/*/lib*.a usr/lib/*/pkgconfig/* +usr/lib/*/lib*.so + diff --git a/debian/libstlink.install b/debian/libstlink.install index 9f7f9316b..08981406e 100644 --- a/debian/libstlink.install +++ b/debian/libstlink.install @@ -1,3 +1,3 @@ -usr/lib/*/lib*.so* +usr/lib/*/lib*.so.* lib/udev/rules.d/*.rules -lib/modprobe.d/*.conf +etc/modprobe.d/*.conf diff --git a/debian/rules b/debian/rules index 419ce1e4d..2b826772b 100755 --- a/debian/rules +++ b/debian/rules @@ -16,42 +16,12 @@ include /usr/share/dpkg/default.mk # package maintainers to append LDFLAGS #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed - # main packaging script based on dh7 syntax %: - dh $@ - - -OUTDIR=build/Release -ROOTDIR=debian/tmp -DSTDIR=$(ROOTDIR)/usr -BINDIR=$(DSTDIR)/bin -SHAREDIR=$(DSTDIR)/share/stlink -LIBDIR=$(DSTDIR)/lib/$(if $(DEB_TARGET_MULTIARCH),$(DEB_TARGET_MULTIARCH),$(DEB_BUILD_MULTIARCH)) -UDEVDIR=$(ROOTDIR)/lib/udev/rules.d/ -MODDIR=$(ROOTDIR)/lib/modprobe.d/ - -export CMAKEFLAGS = \ - -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \ - -DCMAKE_INSTALL_PREFIX=/usr \ - + dh $@ --buildsystem cmake +# debmake generated override targets +# This is example for Cmake (See http://bugs.debian.org/641051 ) override_dh_auto_configure: - -override_dh_auto_install: - install -d $(DSTDIR)/include/stlink/tools - install -d $(LIBDIR)/pkgconfig - install -d $(BINDIR) - install -d $(SHAREDIR) - install -d $(UDEVDIR) - install -d $(MODDIR) - install -m644 $(wildcard include/*.h) $(DSTDIR)/include - install -m644 $(wildcard include/stlink/*.h) $(DSTDIR)/include/stlink - install -m644 $(wildcard include/stlink/tools/*.h) $(DSTDIR)/include/stlink/tools - install -m755 $(wildcard $(OUTDIR)/st-* $(OUTDIR)/src/gdbserver/st-* $(OUTDIR)/src/tools/gui/stlink-gui*) $(BINDIR) - cp -d $(wildcard $(OUTDIR)/libstlink.*) $(LIBDIR) - install -m644 $(OUTDIR)/usr/lib/pkgconfig/stlink.pc $(LIBDIR)/pkgconfig - install -m644 src/tools/gui/stlink-gui.ui $(SHAREDIR) - install -m644 etc/udev/rules.d/*.rules $(UDEVDIR) - install -m644 etc/modprobe.d/*.conf $(MODDIR) - + dh_auto_configure -- \ + -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) diff --git a/debian/stlink-gui.install b/debian/stlink-gui.install index eedcd7172..d18d2cec4 100644 --- a/debian/stlink-gui.install +++ b/debian/stlink-gui.install @@ -1,2 +1,2 @@ /usr/bin/stlink-gui* -/usr/share/* +/usr/share/stlink/stlink-gui.ui