From 650a88aa2c9feaee482d5ed6130fea15c6d3929e Mon Sep 17 00:00:00 2001 From: Andrew Andrianov Date: Fri, 23 Sep 2016 12:54:43 +0300 Subject: [PATCH] debian: Remove all useless stuff from debian/rules, force cmake buildsystem The top-level makefile that was used to drive cmake broke the autodetection of the used buildsystem by debhelper. This commit fixes it and moves most of the installation stuff to CMakeLists.txt to keep debian/ folder contents to the bare minimum. Signed-off-by: Andrew Andrianov --- CMakeLists.txt | 8 ++++++++ Makefile | 4 ++++ cmake/CPackConfig.cmake | 2 ++ debian/libstlink-dev.install | 2 ++ debian/libstlink.install | 4 ++-- debian/rules | 40 +++++------------------------------- debian/stlink-gui.install | 2 +- 7 files changed, 24 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d5a031..f648843 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 fca19d6..2ddfcee 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 4e851ef..1dfd376 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 1eff329..0c3543c 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 9f7f931..0898140 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 419ce1e..2b82677 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 eedcd71..d18d2ce 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