Add Debian package build

This commit is contained in:
deeaitch committed 2026-08-28 01:46:43 -04:00
1 parent 6ed48022ae
commit eee200299a
10 files changed
+154 -18

No files matched your search

+1 -1
View File
@@ -24,6 +24,7 @@ tags
.directory
*.debug
Makefile*
/build-debian/
*.prl
*.app
moc_*.cpp
@@ -71,4 +72,3 @@ CMakeLists.txt.user*
# --------
*.dll
*.exe
+25 -17
View File
@@ -1,28 +1,31 @@
cmake_minimum_required(VERSION 3.16)
project(kindle2notes VERSION 1.0 LANGUAGES CXX)
project(kindle2notes VERSION 1.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(KINDLE2NOTES_VERSION "${PROJECT_VERSION}")
find_package(Git QUIET)
if(Git_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty --always
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE KINDLE2NOTES_GIT_RESULT
OUTPUT_VARIABLE KINDLE2NOTES_GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
set(KINDLE2NOTES_VERSION "" CACHE STRING "Override the version reported by kindle2notes")
if(KINDLE2NOTES_VERSION STREQUAL "")
set(KINDLE2NOTES_VERSION "${PROJECT_VERSION}")
find_package(Git QUIET)
if(Git_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --long --dirty --always
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE KINDLE2NOTES_GIT_RESULT
OUTPUT_VARIABLE KINDLE2NOTES_GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(KINDLE2NOTES_GIT_RESULT EQUAL 0 AND NOT KINDLE2NOTES_GIT_DESCRIBE STREQUAL "")
if(KINDLE2NOTES_GIT_DESCRIBE MATCHES "^(.+)-0-g[0-9a-f]+$")
set(KINDLE2NOTES_VERSION "${CMAKE_MATCH_1}")
else()
set(KINDLE2NOTES_VERSION "${KINDLE2NOTES_GIT_DESCRIBE}")
if(KINDLE2NOTES_GIT_RESULT EQUAL 0 AND NOT KINDLE2NOTES_GIT_DESCRIBE STREQUAL "")
if(KINDLE2NOTES_GIT_DESCRIBE MATCHES "^(.+)-0-g[0-9a-f]+$")
set(KINDLE2NOTES_VERSION "${CMAKE_MATCH_1}")
else()
set(KINDLE2NOTES_VERSION "${KINDLE2NOTES_GIT_DESCRIBE}")
endif()
endif()
endif()
endif()
@@ -55,3 +58,8 @@ kindle2notes_enable_warnings(kindle2notes)
target_compile_definitions(kindle2notes PRIVATE
KINDLE2NOTES_VERSION="${KINDLE2NOTES_VERSION}"
)
include(GNUInstallDirs)
install(TARGETS kindle2notes
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
+17
View File
@@ -131,6 +131,23 @@ The resulting executable is:
build/kindle2notes
```
### Debian package
On Debian or a Debian-based distribution, install the package build tools and
build the binary package with:
```bash
sudo apt install build-essential cmake dpkg-dev
dpkg-buildpackage --build=binary --no-sign
```
The `.deb`, `.changes`, and `.buildinfo` files are written to the parent
directory. To create a Debian source package instead, run:
```bash
dpkg-buildpackage --build=source --no-sign
```
When the source is built from Git, CMake obtains the version from
`git describe`. A build made exactly from a release tag reports only that tag
(for example, `1.0`). Later commits include their distance from the tag and
+3
View File
@@ -0,0 +1,3 @@
/files
/*.substvars
/kindle2notes/
+5
View File
@@ -0,0 +1,5 @@
kindle2notes (1.1) unstable; urgency=medium
* Initial Debian package.
-- deeaitch <himrodim@gmail.com> Fri, 28 Aug 2026 01:46:16 -0400
+16
View File
@@ -0,0 +1,16 @@
Source: kindle2notes
Section: utils
Priority: optional
Maintainer: deeaitch <himrodim@gmail.com>
Build-Depends: cmake (>= 3.16), g++, dpkg-dev
Standards-Version: 4.6.2
Rules-Requires-Root: no
Homepage: https://git.himro.ca/deeaitch/kindle2notes
Package: kindle2notes
Architecture: any
Depends: ${shlibs:Depends}
Description: convert Kindle clippings into structured notes
kindle2notes converts Amazon Kindle My Clippings text exports into
human-editable LaTeX, Markdown, Org mode, or AsciiDoc documents. Highlights
are grouped by book title and include dedicated sections for personal notes.
+40
View File
@@ -0,0 +1,40 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: kindle2notes
Source: https://git.himro.ca/deeaitch/kindle2notes
Files: *
Copyright: 2026 deeaitch <himrodim@gmail.com>
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
On Debian systems, the complete text of the GNU General Public License
version 3 can be found in "/usr/share/common-licenses/GPL-3".
Files: typefactory/typefactory.h
Copyright: 2026 Dim Himro
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Vendored Executable
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
PACKAGE := kindle2notes
BUILD_DIR := build-debian
PACKAGE_DIR := $(CURDIR)/debian/$(PACKAGE)
PACKAGE_VERSION := $(shell dpkg-parsechangelog -S Version)
.PHONY: clean build build-arch build-indep binary binary-arch binary-indep
clean:
rm -rf $(BUILD_DIR) $(PACKAGE_DIR)
rm -f debian/files debian/*.substvars
build: build-arch build-indep
build-arch:
cmake -S . -B $(BUILD_DIR) \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DKINDLE2NOTES_VERSION=$(PACKAGE_VERSION) \
-DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS)" \
-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)"
cmake --build $(BUILD_DIR) --parallel
build-indep:
binary: binary-arch binary-indep
binary-arch: build-arch
DESTDIR=$(PACKAGE_DIR) cmake --install $(BUILD_DIR)
strip --strip-unneeded $(PACKAGE_DIR)/usr/bin/$(PACKAGE)
install -d $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE)
install -m 0644 debian/copyright $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE)/copyright
install -m 0644 README.md $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE)/README.md
gzip -n -9 -c debian/changelog > $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE)/changelog.Debian.gz
install -d $(PACKAGE_DIR)/DEBIAN
dpkg-shlibdeps -Tdebian/$(PACKAGE).substvars debian/$(PACKAGE)/usr/bin/$(PACKAGE)
dpkg-gencontrol -p$(PACKAGE) -P$(PACKAGE_DIR) -Tdebian/$(PACKAGE).substvars
dpkg-deb --build --root-owner-group $(PACKAGE_DIR) ..
binary-indep:
+1
View File
@@ -0,0 +1 @@
3.0 (native)
+2
View File
@@ -0,0 +1,2 @@
tar-ignore = .git
tar-ignore = *.pro.user