Blame SOURCES/lshw-B.02.19.2-cmake.patch

b58cad
From 5da5b63bd38634834bb3e631a24e31a10ab60f27 Mon Sep 17 00:00:00 2001
b58cad
From: Terje Rosten <terje.rosten@ntnu.no>
b58cad
Date: Wed, 25 Mar 2020 21:57:53 +0100
99c025
Subject: [PATCH] cmakeify
99c025
99c025
---
b58cad
 CMakeLists.txt                                |  43 ++++++
b58cad
 Makefile                                      |  20 ---
b58cad
 README.md                                     |  51 ++++---
b58cad
 lshw.spec.in                                  |  66 +++-----
b58cad
 src/CMakeLists.txt                            | 102 +++++++++++++
b58cad
 src/Makefile                                  | 144 ------------------
b58cad
 src/core/Makefile                             |  80 ----------
b58cad
 src/core/{config.h => config.h.in}            |  28 +---
b58cad
 src/core/db.cc                                |   8 +
b58cad
 src/core/dump.cc                              |   2 +-
b58cad
 src/core/version.h                            |   2 +
b58cad
 src/gui/CMakeLists.txt                        |  67 ++++++++
b58cad
 src/gui/Makefile                              |  61 --------
b58cad
 .../{gtk-lshw.desktop => gtk-lshw.desktop.in} |   7 +-
b58cad
 src/gui/integration/lshw-gui.in               |   5 +
b58cad
 .../integration/org.ezix.lshw.gui.policy.in   |  20 +++
b58cad
 src/gui/stock.c                               |   1 +
b58cad
 src/po/CMakeLists.txt                         |  16 ++
b58cad
 src/po/Makefile                               |  23 ---
b58cad
 19 files changed, 327 insertions(+), 419 deletions(-)
99c025
 create mode 100644 CMakeLists.txt
99c025
 delete mode 100644 Makefile
99c025
 create mode 100644 src/CMakeLists.txt
99c025
 delete mode 100644 src/Makefile
99c025
 delete mode 100644 src/core/Makefile
99c025
 rename src/core/{config.h => config.h.in} (50%)
99c025
 create mode 100644 src/gui/CMakeLists.txt
99c025
 delete mode 100644 src/gui/Makefile
99c025
 rename src/gui/integration/{gtk-lshw.desktop => gtk-lshw.desktop.in} (51%)
99c025
 create mode 100644 src/gui/integration/lshw-gui.in
99c025
 create mode 100644 src/gui/integration/org.ezix.lshw.gui.policy.in
99c025
 create mode 100644 src/po/CMakeLists.txt
99c025
 delete mode 100644 src/po/Makefile
99c025
99c025
diff --git a/CMakeLists.txt b/CMakeLists.txt
99c025
new file mode 100644
b58cad
index 0000000..3b1d4d6
99c025
--- /dev/null
99c025
+++ b/CMakeLists.txt
b58cad
@@ -0,0 +1,43 @@
99c025
+cmake_minimum_required(VERSION 3.0)
99c025
+
99c025
+project(lshw)
b58cad
+set(VERSION "B.02.19.2")
99c025
+
b58cad
+find_package(Git)
b58cad
+
b58cad
+if(EXISTS "${PROJECT_SOURCE_DIR}/.git" AND "${MAKE_RELEASE}" STREQUAL "")
99c025
+  if(GIT_FOUND)
99c025
+    execute_process(
99c025
+      COMMAND ${GIT_EXECUTABLE} describe --tags
99c025
+      OUTPUT_VARIABLE DESCRIBE_TAG
99c025
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
99c025
+    string(REGEX MATCH "B.[0-9]+.[0-9]+[-][0-9]+" VERSION ${DESCRIBE_TAG})
99c025
+    string(REPLACE "-" "." VERSION ${VERSION})
99c025
+  endif()
99c025
+endif()
99c025
+
99c025
+message("-- lshw: ${VERSION}")
99c025
+
99c025
+option(GUI "Enable GUI application (${PROJECT_NAME}-gtk)" ON)
99c025
+option(HWDATA "Install hwdata files" ON)
99c025
+option(SQLITE "Enable SQLite support" OFF)
99c025
+option(ZLIB "Enable zlib support" OFF)
99c025
+option(NOLOGO "Don't install vendor logos" OFF)
99c025
+option(STATIC "Do a static (will disable other features)" OFF)
99c025
+option(POLICYKIT "Install PolicyKit file and pfexec wrapper" OFF)
99c025
+
99c025
+include(GNUInstallDirs)
99c025
+set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE STRING "Install prefix")
99c025
+set(DATADIR "${CMAKE_INSTALL_FULL_DATADIR}")
99c025
+set(PROJECT_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
99c025
+set(SBINDIR "${CMAKE_INSTALL_FULL_SBINDIR}")
99c025
+set(MANDIR "${CMAKE_INSTALL_FULL_MANDIR}")
99c025
+set(LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
99c025
+
99c025
+configure_file(
99c025
+  "${PROJECT_SOURCE_DIR}/lshw.spec.in"
99c025
+  "${PROJECT_BINARY_DIR}/lshw.spec")
99c025
+
99c025
+add_subdirectory(src)
99c025
+add_subdirectory(src/po)
99c025
+add_subdirectory(src/gui)
99c025
diff --git a/Makefile b/Makefile
99c025
deleted file mode 100644
99c025
index 8fe665e..0000000
99c025
--- a/Makefile
99c025
+++ /dev/null
99c025
@@ -1,20 +0,0 @@
99c025
-PACKAGENAME = lshw
99c025
-VERSION?= $(shell git describe --tags | cut -d - -f 1,2 | tr - .)
99c025
-export PACKAGENAME
99c025
-
99c025
-all clean install snapshot gui install-gui:
99c025
-	+$(MAKE) -C src $@
99c025
-
99c025
-version.cpe: .version
99c025
-	echo -n cpe:/a:ezix:$(PACKAGENAME): > $@
99c025
-	cat $^ >> $@
99c025
-
99c025
-.PHONY: $(PACKAGENAME).spec
99c025
-
99c025
-$(PACKAGENAME).spec: $(PACKAGENAME).spec.in
99c025
-	cat $^ | sed -e s/\@VERSION\@/$(VERSION)/g > $@
99c025
-
99c025
-release: $(PACKAGENAME).spec
99c025
-	git archive --prefix=$(PACKAGENAME)-$(VERSION)/ -o $(PACKAGENAME)-$(VERSION).tar HEAD
99c025
-	tar --transform s!^!$(PACKAGENAME)-$(VERSION)/! -rf $(PACKAGENAME)-$(VERSION).tar $^
99c025
-	gzip -f $(PACKAGENAME)-$(VERSION).tar
99c025
diff --git a/README.md b/README.md
b58cad
index 30feaf1..294888c 100644
99c025
--- a/README.md
99c025
+++ b/README.md
b58cad
@@ -15,27 +15,29 @@ Installation
99c025
  1. Requirements
99c025
    - Linux 2.4.x, 2.6.x, 3.x or 4.x (2.2.x might work, though)
99c025
    - a PA-RISC-, Alpha-, IA-64- (Itanium-), PowerPC-, ARM- or x86- based machine
99c025
+   - cmake, GNU make or Ninja
99c025
    - an ANSI (or close enough to ANSI compliance) C++ compiler (tested with g++ 2.95.4 and 3.x)
99c025
    - for the (optional) GTK+ graphical user interface, you will need a
99c025
 	complete GTK+ development environment (gtk2-devel on RedHat/Fedora derivatives) 
99c025
+   - for optional SQLite feature install SQLite
99c025
+   - for optional zlib feature install zlib and gzip
99c025
 
99c025
- 2. To compile it, just use:
b58cad
+ 2. Use cmake options to decide feature set:
b58cad
+   - -DGUI=OFF - disable graphical user interface version og lshw
b58cad
+   - -DZLIB=ON - enable reading of gzipped datafiles
b58cad
+   - -DSQLITE=ON -  enable SQLite support
b58cad
+   - -DPOLICYKIT=ON - enable PolicyKit integration
b58cad
+   - -DNOLOGO=ON - don't install logos with copyright
99c025
 
99c025
-    	$ make
99c025
+ 3. Do configuration and build by
99c025
 
b58cad
-    To compile with zlib support (see below), use:
99c025
-
99c025
-    	$ make ZLIB=1
99c025
-
99c025
- 3. If you want to build the optional GUI, do:
99c025
-
99c025
-    	$ make
99c025
-    	$ make gui
99c025
+       $ mkdir build && cd build
99c025
+       $ cmake .. -GNinja <options>
99c025
+       $ ninja-build
99c025
 
99c025
  4. If you want to install the result, do:
99c025
 
99c025
-    	$ make install
99c025
-    	$ make install-gui
99c025
+       $ ninja-build install
99c025
 
99c025
 Getting help
99c025
 ------------
b58cad
@@ -61,12 +63,27 @@ If compiled with zlib support, lshw will look for `file`.gz first, then for `fil
99c025
 
99c025
 Statically-linked and/or compressed binaries can be built by using
99c025
 
99c025
-    $ make static
99c025
-
99c025
+    $ mkdir build && cd build
99c025
+    $ cmake .. -DSTATIC=ON
99c025
+    $ ninja
99c025
 or
99c025
+    $ mkdir build && cd build
99c025
+    $ cmake .. -GNinja
99c025
+    $ ninja compressed
99c025
 
99c025
-    $ make compressed
99c025
+Building compressed binaries requires `upx` (cf. https://upx.github.io/).
99c025
 
99c025
-in the `src/` directory
b58cad
+Release management and data files maintenance
b58cad
+---------------------------------------------
99c025
 
99c025
-Building compressed binaries requires `upx` (cf. https://upx.github.io/).
99c025
+Create release tarball,
99c025
+
99c025
+ 1. Edit CMakeLists.txt to set version
99c025
+ 2. Run
99c025
+    $ mkdir build && cd build
b58cad
+    $ cmake .. -DMAKE_RELEASE=ON
b58cad
+    $ make release
99c025
+
99c025
+Update hwdata files:
99c025
+
b58cad
+    $ make refresh_hwdata
99c025
diff --git a/lshw.spec.in b/lshw.spec.in
b58cad
index e837fd4..3fe23c2 100644
99c025
--- a/lshw.spec.in
99c025
+++ b/lshw.spec.in
b58cad
@@ -7,11 +7,11 @@ Version: @VERSION@
b58cad
 Release: 2
b58cad
 Source: http://www.ezix.org/software/files/%{name}-%{version}.tar.gz
b58cad
 URL: http://lshw.ezix.org/
b58cad
-License: GPL
b58cad
+License: GPLv2
b58cad
 Group: Applications/System
b58cad
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
b58cad
-
b58cad
-%global debug_package %{nil}
b58cad
+BuildRequires: gcc
b58cad
+BuildRequires: gcc-c++
b58cad
+BuildRequires: cmake
b58cad
 
b58cad
 %description
b58cad
 lshw (Hardware Lister) is a small tool to provide detailed information on
b58cad
@@ -39,7 +39,7 @@ lshw (Hardware Lister) is a small tool to provide detailed informaton on
b58cad
 the hardware configuration of the machine. It can report exact memory
b58cad
 configuration, firmware version, mainboard configuration, CPU version
b58cad
 and speed, cache configuration, bus speed, etc. on DMI-capable x86s
b58cad
- systems and on some PowerPC machines (PowerMac G4 is known to work).
b58cad
+systems and on some PowerPC machines (PowerMac G4 is known to work).
b58cad
 
b58cad
 This package provides a graphical user interface to display hardware
b58cad
 information.
b58cad
@@ -54,61 +54,29 @@ http://lshw.ezix.org/
99c025
 %setup -q
99c025
 
99c025
 %build
99c025
-%{__make} %{?_smp_mflags} \
99c025
-  PREFIX="%{_prefix}" \
99c025
-  SBINDIR="%{_sbindir}" \
99c025
-  MANDIR="%{_mandir}" \
99c025
-  DATADIR="%{_datadir}" \
b58cad
-  VERSION="%{version}" \
99c025
-  all
99c025
-%if %{!?_without_gui:1}0
99c025
-%{__make} %{?_smp_mflags} \
99c025
-  PREFIX="%{_prefix}" \
99c025
-  SBINDIR="%{_sbindir}" \
99c025
-  MANDIR="%{_mandir}" \
99c025
-  DATADIR="%{_datadir}" \
b58cad
-  VERSION="%{version}" \
99c025
-  gui
99c025
-%endif
99c025
+mkdir build && cd build
99c025
+%cmake .. %{?_without_gui:-DGUI=OFF}
99c025
+make %{?_smp_mflags} VERBOSE=1
99c025
 
99c025
 %install
99c025
-%{__rm} -rf "%{buildroot}"
99c025
-
99c025
-%{__make} \
99c025
-  DESTDIR="%{buildroot}" \
99c025
-  PREFIX="%{_prefix}" \
99c025
-  SBINDIR="%{_sbindir}" \
99c025
-  MANDIR="%{_mandir}" \
99c025
-  DATADIR="%{_datadir}" \
99c025
-  INSTALL="%{__install} -p" \
99c025
-  install
99c025
-%if %{!?_without_gui:1}0
99c025
-%{__make} \
99c025
-  DESTDIR="%{buildroot}" \
99c025
-  PREFIX="%{_prefix}" \
99c025
-  SBINDIR="%{_sbindir}" \
99c025
-  MANDIR="%{_mandir}" \
99c025
-  DATADIR="%{_datadir}" \
99c025
-  INSTALL="%{__install} -p" \
99c025
-  install-gui
99c025
-%endif
99c025
-
99c025
-%clean
99c025
-%{__rm} -rf %{buildroot}
99c025
+cd build
99c025
+make install DESTDIR=%{buildroot}
99c025
 
99c025
 %files
99c025
-%defattr(-,root,root, 0555)
99c025
-%doc README.md COPYING docs/TODO docs/Changelog docs/lshw.xsd
99c025
+%license COPYING
b58cad
+%doc docs/TODO docs/Changelog docs/lshw.xsd
99c025
 %{_sbindir}/lshw
b58cad
-%doc %{_mandir}/man?/*
b58cad
+%{_mandir}/man?/*
99c025
 %{_datadir}/lshw/
b58cad
 %{_datadir}/locale/*/*/*
99c025
 
99c025
 %if %{!?_without_gui:1}0
99c025
 %files gui
99c025
-%defattr(-,root,root, 0555)
99c025
-%doc COPYING
99c025
+%license COPYING
99c025
 %{_sbindir}/gtk-lshw
99c025
+%{_datadir}/appdata/gtk-lshw.appdata.xml
99c025
+%{_datadir}/applications/gtk-lshw.desktop
99c025
+%{_datadir}/pixmaps/gtk-lshw.svg
99c025
 %endif
99c025
 
99c025
 %changelog
99c025
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
99c025
new file mode 100644
b58cad
index 0000000..8b97a16
99c025
--- /dev/null
99c025
+++ b/src/CMakeLists.txt
b58cad
@@ -0,0 +1,102 @@
99c025
+if(STATIC)
99c025
+ set(ZLIB OFF)
99c025
+ set(SQLITE OFF)
99c025
+endif()
99c025
+
99c025
+# SQLite support
99c025
+if(SQLITE)
99c025
+  pkg_check_modules(SQLITE3 sqlite3)
99c025
+  if(SQLITE3_FOUND)
99c025
+    message("-- Enabling SQLite support")
99c025
+  else()
99c025
+    message(FATAL_ERROR "SQLite not found, install lib or disable feature: -DSQLITE=OFF")
99c025
+  endif()
99c025
+else()
99c025
+  message("-- SQLite support disabled")
99c025
+endif()
99c025
+
99c025
+# zlib support
99c025
+if(ZLIB)
99c025
+  find_program(GZIP gzip "Path to gzip application")
99c025
+  if(NOT GZIP)
99c025
+    message(FATAL_ERROR "gzip program not found, install gzip or disable zlib support: -DZLIB=OFF")
99c025
+  endif()
99c025
+  pkg_check_modules(Z zlib)
99c025
+  if(Z_FOUND)
99c025
+    message("-- Enabling zlib support")
99c025
+  else()
99c025
+    message(FATAL_ERROR "zlib not found, install lib or disable feature: -DZLIB=OFF")
99c025
+  endif()
99c025
+else()
99c025
+  message("-- zlib support disabled")
99c025
+endif()
99c025
+
99c025
+if(ERROR)
99c025
+  message(FATAL_ERROR "Configuration failed")
99c025
+endif()
99c025
+
99c025
+# Some special targets, compress, refresh_hwdata and release
99c025
+add_custom_target(compressed
99c025
+  COMMAND upx -9 -o lshw-compress lshw
99c025
+  COMMENT "Creating upx compressed binary")
99c025
+add_dependencies(compressed lshw)
99c025
+
99c025
+add_custom_target(refresh_hwdata
99c025
+  COMMAND wget -N http://pciids.sourceforge.net/pci.ids
99c025
+  COMMAND wget -N http://www.linux-usb.org/usb.ids
99c025
+  COMMAND wget -N http://standards-oui.ieee.org/oui/oui.txt
99c025
+  COMMAND wget -O manuf.txt http://anonsvn.wireshark.org/wireshark/trunk/manuf
99c025
+  COMMAND wget -N https://git.fedorahosted.org/cgit/hwdata.git/plain/pnp.ids
99c025
+  COMMAND wget -N http://www-pc.uni-regensburg.de/hardware/TECHNIK/PCI_PNP/pnpid.txt
99c025
+  WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/src"
99c025
+  COMMENT "Updating hwdata files from upstream location")
99c025
+
99c025
+set(TARNAME ${PROJECT_NAME}-${VERSION})
99c025
+add_custom_target(release
99c025
+  COMMAND ${GIT_EXECUTABLE} archive --prefix=${TARNAME}/
99c025
+    -o ${PROJECT_BINARY_DIR}/${TARNAME}.tar HEAD
99c025
+  COMMAND mv ${PROJECT_BINARY_DIR}/lshw.spec ${PROJECT_SOURCE_DIR}/lshw.spec
99c025
+  COMMAND tar --owner=0 --group=0
99c025
+    --transform s,lshw.spec,${TARNAME}/lshw.spec,
99c025
+    -rf ${PROJECT_BINARY_DIR}/${TARNAME}.tar lshw.spec
99c025
+  COMMAND gzip ${PROJECT_BINARY_DIR}/${TARNAME}.tar
99c025
+  COMMAND rm ${PROJECT_SOURCE_DIR}/lshw.spec
99c025
+  WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
99c025
+  COMMENT "Creating release tarball")
99c025
+
99c025
+configure_file(
99c025
+  "${CMAKE_CURRENT_SOURCE_DIR}/core/config.h.in"
99c025
+  "${PROJECT_BINARY_DIR}/config.h")
99c025
+
99c025
+include_directories("${PROJECT_BINARY_DIR}")
99c025
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/core")
99c025
+
99c025
+file(GLOB DATAFILES "pci.ids" "pnp.ids" "usb.ids" "manuf.txt" "oui.txt" "pnpid.txt")
99c025
+
99c025
+file(GLOB SOURCES "core/*.cc")
99c025
+add_library(core ${SOURCES})
99c025
+add_executable(lshw lshw.cc)
99c025
+
99c025
+if(STATIC)
99c025
+  set_target_properties(lshw PROPERTIES LINK_FLAGS "-static" )
99c025
+endif()
99c025
+
b58cad
+target_link_libraries(lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} core resolv)
99c025
+
99c025
+if(NOT ZLIB)
99c025
+  if(HWDATA)
99c025
+    install(FILES ${DATAFILES} DESTINATION ${PROJECT_DATADIR})
99c025
+  endif()
99c025
+else()
99c025
+  foreach(DATAFILE ${DATAFILES})
99c025
+    get_filename_component(FILE ${DATAFILE} NAME)
99c025
+    add_custom_command(
99c025
+      OUTPUT ${FILE}.gz
99c025
+      COMMAND ${GZIP} -c ${DATAFILE} > ${FILE}.gz)
99c025
+    add_custom_target(${FILE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.gz)
99c025
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.gz DESTINATION ${PROJECT_DATADIR})
99c025
+  endforeach()
99c025
+endif()
99c025
+
99c025
+install(FILES lshw.1 DESTINATION ${MANDIR}/man1 COMPONENT doc)
99c025
+install(TARGETS lshw DESTINATION sbin)
99c025
diff --git a/src/Makefile b/src/Makefile
99c025
deleted file mode 100644
b58cad
index 7ae8218..0000000
99c025
--- a/src/Makefile
99c025
+++ /dev/null
99c025
@@ -1,144 +0,0 @@
99c025
-PACKAGENAME:=lshw
99c025
-export PACKAGENAME
99c025
-VERSION?= $(shell git describe --tags --long | cut -d - -f 1,2 | tr - .)
99c025
-
99c025
-SQLITE?=0
99c025
-ZLIB?=0
99c025
-
99c025
-DESTDIR?=/
99c025
-PREFIX?=/usr
99c025
-SBINDIR=$(PREFIX)/sbin
99c025
-MANDIR=$(PREFIX)/share/man
99c025
-DATADIR=$(PREFIX)/share
99c025
-INSTALL?=install -p
99c025
-STRIP?=strip
99c025
-export DESTDIR
99c025
-export PREFIX
99c025
-export SBINDIR
99c025
-export MANDIR
99c025
-export DATADIR
99c025
-export SQLITE
99c025
-export ZLIB
99c025
-
b58cad
-CXX?=$(CROSS_COMPILE)c++
99c025
-INCLUDES=-I./core/
99c025
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\"
99c025
-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
99c025
-ifeq ($(SQLITE), 1)
99c025
-	CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3)
99c025
-endif
99c025
-ifeq ($(ZLIB), 1)
99c025
-	CXXFLAGS+= -DZLIB $(shell pkg-config --cflags zlib)
99c025
-endif
b58cad
-LDFLAGS+=-L./core/ -g
99c025
-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
99c025
-	LDFLAGS+= -Wl,--as-needed
99c025
-endif
99c025
-LDSTATIC=-static
99c025
-LIBS+=-llshw -lresolv
99c025
-ifeq ($(SQLITE), 1)
99c025
-	LIBS+= $(shell pkg-config --libs sqlite3)
99c025
-endif
99c025
-ifeq ($(ZLIB), 1)
99c025
-	LIBS+= $(shell pkg-config --libs zlib)
99c025
-endif
99c025
-
99c025
-export CXXFLAGS
99c025
-export LIBS
99c025
-export LDFLAGS
99c025
-
99c025
-ifeq ($(ZLIB), 1)
99c025
-DATAFILES = pci.ids.gz usb.ids.gz oui.txt.gz manuf.txt.gz pnp.ids.gz pnpid.txt.gz
99c025
-else
99c025
-DATAFILES = pci.ids usb.ids oui.txt manuf.txt pnp.ids pnpid.txt
99c025
-endif
99c025
-
99c025
-all: $(PACKAGENAME) $(PACKAGENAME).1 $(DATAFILES)
99c025
-
99c025
-.cc.o:
99c025
-	$(CXX) $(CXXFLAGS) -c $< -o $@
99c025
-
99c025
-%.gz: %
99c025
-	gzip -c $< > $@
99c025
-
99c025
-.PHONY: core
99c025
-core:
99c025
-	+make -C core all
99c025
-
99c025
-$(PACKAGENAME): core $(PACKAGENAME).o
99c025
-	$(CXX) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
99c025
-
99c025
-.PHONY: po
99c025
-po:
99c025
-	+make -C po all
99c025
-
99c025
-.PHONY: gui
99c025
-gui: core
99c025
-	+make -C gui all
99c025
-
99c025
-.PHONY: nologo
99c025
-nologo:
99c025
-	cp -f gui/artwork/nologo/* gui/artwork/
99c025
-
99c025
-.PHONY: static
99c025
-static: $(PACKAGENAME)-static
99c025
-
99c025
-$(PACKAGENAME)-static: core core/lib$(PACKAGENAME).a $(PACKAGENAME).o
99c025
-	$(CXX) $(LDSTATIC) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
99c025
-	$(STRIP) $@
99c025
-
99c025
-.PHONY: compressed
99c025
-compressed: $(PACKAGENAME)-compressed
99c025
-
99c025
-$(PACKAGENAME)-compressed: $(PACKAGENAME)-static
99c025
-	upx -9 -o $@ $<
99c025
-
99c025
-$(PACKAGENAME).1: $(PACKAGENAME).sgml
99c025
-	docbook2man $<
99c025
-
99c025
-pci.ids:
99c025
-	wget http://pciids.sourceforge.net/pci.ids
99c025
-
99c025
-usb.ids:
99c025
-	wget http://www.linux-usb.org/usb.ids
99c025
-
99c025
-oui.txt:
99c025
-	wget http://standards.ieee.org/regauth/oui/oui.txt
99c025
-
99c025
-manuf.txt:
99c025
-	wget -O $@ http://anonsvn.wireshark.org/wireshark/trunk/manuf
99c025
-
99c025
-pnp.ids:
99c025
-	wget https://git.fedorahosted.org/cgit/hwdata.git/plain/pnp.ids
99c025
-
99c025
-pnpid.txt:
99c025
-	wget http://www-pc.uni-regensburg.de/hardware/TECHNIK/PCI_PNP/pnpid.txt
99c025
-
99c025
-install: all
99c025
-	$(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR)
99c025
-	$(INSTALL) -m 0755 $(PACKAGENAME) $(DESTDIR)/$(SBINDIR)
99c025
-	$(INSTALL) -d -m 0755 $(DESTDIR)/$(MANDIR)/man1
99c025
-	$(INSTALL) -m 0644 $(PACKAGENAME).1 $(DESTDIR)/$(MANDIR)/man1
99c025
-	$(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)
99c025
-	$(INSTALL) -m 0644 $(DATAFILES) $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)
99c025
-	make -C po install
99c025
-
99c025
-install-gui: gui
99c025
-	$(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR)
99c025
-	$(INSTALL) -m 0755 gui/gtk-$(PACKAGENAME) $(DESTDIR)/$(SBINDIR)
99c025
-	$(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork
99c025
-	$(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui
99c025
-	$(INSTALL) -m 0644 gui/*.ui $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui
99c025
-	$(INSTALL) -m 0644 gui/artwork/*.svg $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork
99c025
-	
99c025
-clean:
99c025
-	rm -f $(PACKAGENAME).o $(PACKAGENAME) $(PACKAGENAME)-static $(PACKAGENAME)-compressed
99c025
-	rm -f $(addsuffix .gz,$(DATAFILES))
99c025
-	make -C core clean
99c025
-	make -C gui clean
99c025
-
99c025
-depend:
99c025
-	@makedepend -Y $(SRCS) 2> /dev/null > /dev/null
99c025
-
99c025
-
99c025
-# DO NOT DELETE
99c025
diff --git a/src/core/Makefile b/src/core/Makefile
99c025
deleted file mode 100644
b58cad
index b429380..0000000
99c025
--- a/src/core/Makefile
99c025
+++ /dev/null
99c025
@@ -1,80 +0,0 @@
99c025
-PACKAGENAME?=lshw
99c025
-
b58cad
-CXX?=$(CROSS_COMPILE)c++
99c025
-INCLUDES=
99c025
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
99c025
-CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
99c025
-LDFLAGS=
99c025
-LDSTATIC=
99c025
-LIBS=
99c025
-
b58cad
-OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o s390.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o nvme.o mmc.o
99c025
-ifeq ($(SQLITE), 1)
99c025
-	OBJS+= db.o
99c025
-endif
99c025
-SRCS = $(OBJS:.o=.cc)
99c025
-
99c025
-all: lib$(PACKAGENAME).a
99c025
-
99c025
-.cc.o:
99c025
-	$(CXX) $(CXXFLAGS) -c $< -o $@
99c025
-
99c025
-lib$(PACKAGENAME).a: $(OBJS)
99c025
-	$(AR) rs $@ $^
99c025
-
99c025
-install: all
99c025
-	
99c025
-clean:
99c025
-	rm -f $(OBJS) lib$(PACKAGENAME).a
99c025
-
99c025
-depend:
99c025
-	@makedepend -Y $(SRCS) 2> /dev/null > /dev/null
99c025
-
99c025
-
99c025
-# DO NOT DELETE
99c025
-
99c025
-hw.o: hw.h osutils.h version.h config.h options.h heuristics.h
99c025
-main.o: hw.h print.h version.h options.h mem.h dmi.h cpuinfo.h cpuid.h
99c025
-main.o: device-tree.h pci.h pcmcia.h pcmcia-legacy.h ide.h scsi.h spd.h
99c025
-main.o: network.h isapnp.h fb.h usb.h sysfs.h display.h parisc.h cpufreq.h
99c025
-main.o: ideraid.h mounts.h smp.h abi.h s390.h virtio.h pnp.h vio.h
99c025
-print.o: print.h hw.h options.h version.h osutils.h config.h
99c025
-mem.o: version.h config.h mem.h hw.h sysfs.h
99c025
-dmi.o: version.h config.h dmi.h hw.h osutils.h
99c025
-device-tree.o: version.h device-tree.h hw.h osutils.h
99c025
-cpuinfo.o: version.h cpuinfo.h hw.h osutils.h
99c025
-osutils.o: version.h osutils.h
99c025
-pci.o: version.h config.h pci.h hw.h osutils.h options.h
99c025
-version.o: version.h config.h
99c025
-cpuid.o: version.h cpuid.h hw.h
99c025
-ide.o: version.h cpuinfo.h hw.h osutils.h cdrom.h disk.h heuristics.h
99c025
-cdrom.o: version.h cdrom.h hw.h partitions.h
99c025
-pcmcia-legacy.o: version.h pcmcia-legacy.h hw.h osutils.h
99c025
-scsi.o: version.h mem.h hw.h cdrom.h disk.h osutils.h heuristics.h sysfs.h
99c025
-disk.o: version.h disk.h hw.h osutils.h heuristics.h partitions.h
99c025
-spd.o: version.h spd.h hw.h osutils.h
99c025
-network.o: version.h config.h network.h hw.h osutils.h sysfs.h options.h
99c025
-network.o: heuristics.h
99c025
-isapnp.o: version.h isapnp.h hw.h pnp.h
99c025
-pnp.o: version.h pnp.h hw.h sysfs.h osutils.h
99c025
-fb.o: version.h fb.h hw.h
99c025
-options.o: version.h options.h osutils.h
99c025
-usb.o: version.h usb.h hw.h osutils.h heuristics.h options.h
99c025
-sysfs.o: version.h sysfs.h hw.h osutils.h
99c025
-display.o: display.h hw.h
99c025
-heuristics.o: version.h sysfs.h hw.h osutils.h
99c025
-parisc.o: version.h device-tree.h hw.h osutils.h heuristics.h
99c025
-cpufreq.o: version.h hw.h osutils.h
99c025
-partitions.o: version.h partitions.h hw.h blockio.h lvm.h volumes.h osutils.h
99c025
-blockio.o: version.h blockio.h osutils.h
99c025
-lvm.o: version.h lvm.h hw.h blockio.h osutils.h
99c025
-ideraid.o: version.h cpuinfo.h hw.h osutils.h cdrom.h disk.h heuristics.h
99c025
-pcmcia.o: version.h pcmcia.h hw.h osutils.h sysfs.h
99c025
-volumes.o: version.h volumes.h hw.h blockio.h lvm.h osutils.h
99c025
-mounts.o: version.h mounts.h hw.h osutils.h
99c025
-smp.o: version.h smp.h hw.h osutils.h
99c025
-abi.o: version.h abi.h hw.h osutils.h
99c025
-jedec.o: jedec.h
99c025
-s390.o: hw.h sysfs.h disk.h s390.h
99c025
-virtio.o: version.h hw.h sysfs.h disk.h virtio.h
99c025
-vio.o: version.h hw.h sysfs.h vio.h
99c025
diff --git a/src/core/config.h b/src/core/config.h.in
99c025
similarity index 50%
99c025
rename from src/core/config.h
99c025
rename to src/core/config.h.in
99c025
index 69023fd..ca25a5f 100644
99c025
--- a/src/core/config.h
99c025
+++ b/src/core/config.h.in
99c025
@@ -13,27 +13,15 @@
99c025
 #define N_(String) gettext_noop (String)
99c025
 #endif
99c025
 
99c025
-#ifndef PACKAGE
99c025
-#define PACKAGE "lshw"
99c025
-#endif
99c025
-
99c025
-#ifndef PREFIX
99c025
-#define PREFIX "/usr"
99c025
-#endif
99c025
-
99c025
-#ifndef SBINDIR
99c025
-#define SBINDIR PREFIX"/sbin"
99c025
-#endif
99c025
+#define PACKAGE "@PROJECT_NAME@"
99c025
+#define VERSION "@VERSION@"
99c025
 
99c025
-#ifndef DATADIR
99c025
-#define DATADIR PREFIX"/share/lshw"
99c025
-#endif
99c025
+#define SBINDIR "@SBINDIR@"
99c025
+#define DATADIR "@DATADIR@"
99c025
+#define MANDIR "@MANDIR@"
99c025
+#define LOCALEDIR "@LOCALEDIR@"
99c025
 
99c025
-#ifndef MANDIR
99c025
-#define MANDIR PREFIX"/share/man"
99c025
-#endif
99c025
+#cmakedefine SQLITE 1
99c025
+#cmakedefine ZLIB 1
99c025
 
99c025
-#ifndef LOCALEDIR
99c025
-#define LOCALEDIR PREFIX"/share/locale"
99c025
-#endif
99c025
 #endif
99c025
diff --git a/src/core/db.cc b/src/core/db.cc
99c025
index d080295..f85c85b 100644
99c025
--- a/src/core/db.cc
99c025
+++ b/src/core/db.cc
99c025
@@ -1,6 +1,12 @@
99c025
+
99c025
 #include <string.h>
99c025
 #include <string>
99c025
 #include <stdexcept>
99c025
+
99c025
+#include "config.h"
99c025
+
99c025
+#ifdef SQLITE
99c025
+
99c025
 #include <sqlite3.h>
99c025
 
99c025
 #include "db.h"
99c025
@@ -419,3 +425,5 @@ value statement::operator[](const string & i) const
99c025
 {
99c025
   return column(i);
99c025
 }
99c025
+
99c025
+#endif /* SQLITE */
99c025
diff --git a/src/core/dump.cc b/src/core/dump.cc
99c025
index 6bc9674..f22f0fb 100644
99c025
--- a/src/core/dump.cc
99c025
+++ b/src/core/dump.cc
99c025
@@ -1,5 +1,5 @@
99c025
-#include "dump.h"
99c025
 #include "version.h"
99c025
+#include "dump.h"
99c025
 #include "osutils.h"
99c025
 
99c025
 #include <time.h>
99c025
diff --git a/src/core/version.h b/src/core/version.h
99c025
index 91e039a..5cecdda 100644
99c025
--- a/src/core/version.h
99c025
+++ b/src/core/version.h
99c025
@@ -1,6 +1,8 @@
99c025
 #ifndef _VERSION_H_
99c025
 #define _VERSION_H_
99c025
 
99c025
+#include "config.h"
99c025
+
99c025
 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
99c025
 #define __ID(string) __asm__(".ident\t\"" string "\"")
99c025
 #else
99c025
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
99c025
new file mode 100644
b58cad
index 0000000..3489053
99c025
--- /dev/null
99c025
+++ b/src/gui/CMakeLists.txt
99c025
@@ -0,0 +1,67 @@
99c025
+if(NOT GUI OR STATIC)
99c025
+  message("-- gtk-${PROJECT_NAME} disabled")
99c025
+  return()
99c025
+endif()
99c025
+
99c025
+find_package(PkgConfig)
99c025
+pkg_check_modules(GTK2 REQUIRED gtk+-2.0 gmodule-2.0)
99c025
+
99c025
+file(GLOB GTK_SOURCES "*.c*")
99c025
+
99c025
+include_directories("${PROJECT_BINARY_DIR}")
99c025
+include_directories("${PROJECT_SOURCE_DIR}/src/core")
99c025
+
99c025
+include_directories("${GTK2_INCLUDE_DIRS}")
99c025
+
99c025
+add_executable(gtk-lshw ${GTK_SOURCES})
b58cad
+target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK2_LIBRARIES} core resolv)
99c025
+install(TARGETS gtk-lshw DESTINATION sbin)
99c025
+
99c025
+if(POLICYKIT)
99c025
+  set(desktop_exec ${CMAKE_INSTALL_FULL_BINDIR}/lshw-gui)
99c025
+  configure_file(
99c025
+    "${CMAKE_CURRENT_SOURCE_DIR}/integration/org.ezix.lshw.gui.policy.in"
99c025
+    "${CMAKE_CURRENT_BINARY_DIR}/org.ezix.lshw.gui.policy")
99c025
+  configure_file(
99c025
+    "${CMAKE_CURRENT_SOURCE_DIR}/integration/lshw-gui.in"
99c025
+    "${CMAKE_CURRENT_BINARY_DIR}/lshw-gui")
99c025
+else()
99c025
+  set(desktop_exec ${CMAKE_INSTALL_FULL_SBINDIR}/gtk-lshw)
99c025
+endif()
99c025
+
99c025
+configure_file(
99c025
+  "${CMAKE_CURRENT_SOURCE_DIR}/integration/gtk-lshw.desktop.in"
99c025
+  "${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.desktop")
99c025
+configure_file(
99c025
+  "${CMAKE_CURRENT_SOURCE_DIR}/artwork/logo.svg"
99c025
+  "${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.svg")
99c025
+
99c025
+file(GLOB LOGOS "artwork/*.svg")
99c025
+file(GLOB NOLOGOS "artwork/nologo/*.svg")
99c025
+
99c025
+if(NOLOGO)
99c025
+  install(FILES ${NOLOGOS} DESTINATION ${PROJECT_DATADIR}/artwork)
99c025
+  foreach(LOGO ${LOGOS})
99c025
+    get_filename_component(BASENAME ${LOGO} NAME)
99c025
+    if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/artwork/nologo/${BASENAME}")
99c025
+      list(REMOVE_ITEM LOGOS ${LOGO})
99c025
+    endif()
99c025
+  endforeach()
99c025
+endif()
99c025
+
99c025
+install(FILES ${LOGOS} DESTINATION ${PROJECT_DATADIR}/artwork)
99c025
+install(FILES gtk-lshw.ui DESTINATION ${PROJECT_DATADIR}/ui)
b58cad
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.desktop
99c025
+  DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
99c025
+install(FILES integration/gtk-lshw.appdata.xml DESTINATION
99c025
+  ${CMAKE_INSTALL_FULL_DATADIR}/appdata)
99c025
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.svg DESTINATION
99c025
+  ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps)
99c025
+
99c025
+
99c025
+if(POLICYKIT)
99c025
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.ezix.lshw.gui.policy
99c025
+    DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/polkit-1/actions)
99c025
+  install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lshw-gui
99c025
+    DESTINATION bin)
99c025
+endif()
99c025
diff --git a/src/gui/Makefile b/src/gui/Makefile
99c025
deleted file mode 100644
b58cad
index f003cfb..0000000
99c025
--- a/src/gui/Makefile
99c025
+++ /dev/null
99c025
@@ -1,61 +0,0 @@
99c025
-PACKAGENAME?=lshw
99c025
-
b58cad
-CXX?=$(CROSS_COMPILE)c++
b58cad
-CC?=$(CROSS_COMPILE)cc
99c025
-STRIP?=strip
99c025
-OBJCOPY?=objcopy
99c025
-
99c025
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
99c025
-GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags)
99c025
-INCLUDES=-I../core $(GTKINCLUDES)
99c025
-CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
99c025
-ifeq ($(SQLITE), 1)
99c025
-	CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3)
99c025
-endif
b58cad
-CFLAGS=$(CXXFLAGS) -g $(DEFINES)
99c025
-GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs)
99c025
-LIBS+=-L../core -llshw -lresolv $(GTKLIBS)
99c025
-ifeq ($(SQLITE), 1)
99c025
-	LIBS+= $(shell pkg-config --libs sqlite3)
99c025
-endif
99c025
-LDFLAGS=
99c025
-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
99c025
-	LDFLAGS+= -Wl,--as-needed
99c025
-endif
99c025
-
99c025
-OBJS = gtk-lshw.o callbacks.o engine.o print-gui.o stock.o
99c025
-SRCS = $(OBJS:.o=.c)
99c025
-
99c025
-all: gtk-$(PACKAGENAME)
99c025
-
99c025
-.cc.o:
99c025
-	$(CXX) $(CXXFLAGS) -c $< -o $@
99c025
-
99c025
-.c.o:
99c025
-	$(CC) $(CFLAGS) -c $< -o $@
99c025
-
99c025
-.PHONY: icon
99c025
-icon: gtk-$(PACKAGENAME) artwork/logo.svg
99c025
-	$(OBJCOPY) --add-section .icon=artwork/logo.svg gtk-$(PACKAGENAME)
99c025
-
99c025
-interface.c: gtk-lshw.glade gtk-lshw.gladep
99c025
-	glade-2 -w gtk-lshw.glade
99c025
-
99c025
-gtk-$(PACKAGENAME): $(OBJS) ../core/liblshw.a
99c025
-	$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
99c025
-
99c025
-install: all
99c025
-	$(STRIP) gtk-$(PACKAGENAME)
99c025
-	
99c025
-clean:
99c025
-	rm -f $(OBJS) gtk-$(PACKAGENAME) gtk-lshw.glade.bak gtk-lshw.gladep.bak callbacks.c.bak callbacks.h.bak Makefile.bak
99c025
-
99c025
-depend:
99c025
-	@makedepend -Y $(SRCS) 2> /dev/null > /dev/null
99c025
-
99c025
-
99c025
-# DO NOT DELETE
99c025
-
99c025
-gtk-lshw.o: stock.h engine.h
99c025
-callbacks.o: callbacks.h support.h engine.h
99c025
-stock.o: stock.h
99c025
diff --git a/src/gui/integration/gtk-lshw.desktop b/src/gui/integration/gtk-lshw.desktop.in
99c025
similarity index 51%
99c025
rename from src/gui/integration/gtk-lshw.desktop
99c025
rename to src/gui/integration/gtk-lshw.desktop.in
99c025
index 4df1c7c..7124c27 100644
99c025
--- a/src/gui/integration/gtk-lshw.desktop
99c025
+++ b/src/gui/integration/gtk-lshw.desktop.in
99c025
@@ -3,10 +3,9 @@ Name=LSHW
99c025
 Comment=HardWare LiSter
99c025
 Comment[fr]=Listeur de matériel
99c025
 Comment[es]=Listar equipamiento
99c025
-Categories=Application;System;X-Red-Hat-Base;X-Fedora;
99c025
-Icon=/usr/share/lshw/artwork/logo.svg
99c025
-Exec=/usr/bin/gtk-lshw
99c025
+Categories=GTK;System;
99c025
+Icon=gtk-lshw
99c025
+Exec=@desktop_exec@
99c025
 Type=Application
99c025
 Terminal=false
99c025
 Encoding=UTF-8
99c025
-X-Desktop-File-Install-Version=0.10
99c025
diff --git a/src/gui/integration/lshw-gui.in b/src/gui/integration/lshw-gui.in
99c025
new file mode 100644
99c025
index 0000000..ac0823b
99c025
--- /dev/null
99c025
+++ b/src/gui/integration/lshw-gui.in
99c025
@@ -0,0 +1,5 @@
99c025
+#! /bin/bash
99c025
+
99c025
+/usr/bin/pkexec @CMAKE_INSTALL_FULL_SBINDIR@/gtk-lshw
99c025
+
99c025
+
99c025
diff --git a/src/gui/integration/org.ezix.lshw.gui.policy.in b/src/gui/integration/org.ezix.lshw.gui.policy.in
99c025
new file mode 100644
99c025
index 0000000..cba4189
99c025
--- /dev/null
99c025
+++ b/src/gui/integration/org.ezix.lshw.gui.policy.in
99c025
@@ -0,0 +1,20 @@
99c025
+
99c025
+
99c025
+"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
99c025
+"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
99c025
+<policyconfig>
99c025
+ <vendor>lshw</vendor>
99c025
+ <vendor_url>http://ezix.org/project/wiki/HardwareLiSter</vendor_url>
99c025
+ <action id="org.ezix.lshw.gui.pkexec.run">
99c025
+    <description>Hardware Lister (lshw) - list hardware information</description>
99c025
+    <message>Authentication is required to run lshw-gui</message>
99c025
+    <icon_name>lshw-gui</icon_name>
99c025
+    <defaults>
99c025
+     <allow_any>no</allow_any>
99c025
+     <allow_inactive>no</allow_inactive>
99c025
+     <allow_active>auth_admin_keep</allow_active>
99c025
+    </defaults>
99c025
+    <annotate key="org.freedesktop.policykit.exec.path">@CMAKE_INSTALL_FULL_SBINDIR@/gtk-lshw</annotate>
99c025
+    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
99c025
+ </action>
99c025
+</policyconfig>
99c025
diff --git a/src/gui/stock.c b/src/gui/stock.c
99c025
index 08675db..2f92332 100644
99c025
--- a/src/gui/stock.c
99c025
+++ b/src/gui/stock.c
99c025
@@ -1,3 +1,4 @@
99c025
+#include "config.h"
99c025
 #include "stock.h"
99c025
 #include <stdlib.h>
99c025
 #include <string.h>
99c025
diff --git a/src/po/CMakeLists.txt b/src/po/CMakeLists.txt
99c025
new file mode 100644
99c025
index 0000000..de2f5c8
99c025
--- /dev/null
99c025
+++ b/src/po/CMakeLists.txt
99c025
@@ -0,0 +1,16 @@
99c025
+include(FindGettext)
99c025
+
99c025
+if (GETTEXT_FOUND)
99c025
+  file(GLOB POTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po")
99c025
+  string(REPLACE ".po" " " LANGS ${POTFILES})
99c025
+  message(STATUS "gettext found: ${LANGS}")
99c025
+  string(REPLACE " " ";" LANGS ${LANGS})
99c025
+  foreach(LANG ${LANGS})
99c025
+    GETTEXT_PROCESS_PO_FILES(${LANG} ALL PO_FILES ${LANG}.po)
99c025
+    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo"
99c025
+      DESTINATION "${CMAKE_INSTALL_FULL_LOCALEDIR}/${LANG}/LC_MESSAGES"
99c025
+      RENAME "${PROJECT_NAME}.mo")
99c025
+  endforeach()
99c025
+else()
99c025
+  message("-- gettext not found")
99c025
+endif()
99c025
diff --git a/src/po/Makefile b/src/po/Makefile
99c025
deleted file mode 100644
99c025
index 36fbdb7..0000000
99c025
--- a/src/po/Makefile
99c025
+++ /dev/null
99c025
@@ -1,23 +0,0 @@
99c025
-PACKAGENAME?=lshw
99c025
-
99c025
-LANGUAGES = fr
99c025
-SRCS = $(LANGUAGES:=.po)
99c025
-CATALOGS = $(LANGUAGES:=.mo)
99c025
-
99c025
-all: $(PACKAGENAME).pot $(CATALOGS)
99c025
-
99c025
-POTFILES:
99c025
-	find .. -name \*.cc > $@
99c025
-	find .. -name \*.c >> $@
99c025
-
99c025
-$(PACKAGENAME).pot: POTFILES
99c025
-	xgettext -F --no-wrap --indent --keyword=_ --keyword=N_ -d $(PACKAGENAME) -o $@ -f POTFILES
99c025
-
99c025
-%.mo: %.po
99c025
-	msgfmt -v -o $@ $^
99c025
-
99c025
-install: $(CATALOGS)
99c025
-	$(foreach i, $(LANGUAGES), install -D $(i).mo $(DESTDIR)/$(DATADIR)/locale/$(i)/LC_MESSAGES/$(PACKAGENAME).mo ;)
99c025
-	
99c025
-clean:
99c025
-	rm -f $(CATALOGS) $(PACKAGENAME).pot
99c025
-- 
b58cad
2.25.1
99c025