Skip to content

Commit 80c5600

Browse files
Use cmake to build packages
1 parent 65ce2ea commit 80c5600

File tree

7 files changed

+56
-78
lines changed

7 files changed

+56
-78
lines changed

.github/workflows/pull_request.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ jobs:
1313
uses: actions/checkout@v2
1414

1515
- name: install required packages
16-
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev librpm-dev libzstd-dev
16+
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev rpm librpm-dev libzstd-dev
1717

1818
- name: Initialize CodeQL
1919
uses: github/codeql-action/init@v1
2020

2121
- name: configure project
22-
# We reuse the build binary only for the releases.
23-
# We set tweak version to off, because it is wrong, as git tag will happen after this step. Releases don't have a tweak, so this is ok.
24-
run: cmake .
22+
run: cmake -DBUILD_TESTS=On .
2523

2624
- name: build project
27-
run: cmake --build . -j$(nproc)
25+
run: cmake --build . -j$(nproc) --target package
2826

2927
- name: run fastfetch
3028
run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true
@@ -35,8 +33,5 @@ jobs:
3533
- name: run tests
3634
run: ctest
3735

38-
- name: build deb package
39-
run: sh packaging/deb/create.sh .
40-
4136
- name: perform CodeQL analysis
4237
uses: github/codeql-action/analyze@v1

.github/workflows/push.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ jobs:
1616
uses: actions/checkout@v2
1717

1818
- name: install required packages
19-
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev librpm-dev libzstd-dev
19+
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev rpm librpm-dev libzstd-dev
2020

2121
- name: Initialize CodeQL
2222
uses: github/codeql-action/init@v1
2323

2424
- name: configure project
2525
# We reuse the build binary only for the releases.
2626
# We set tweak version to off, because it is wrong, as git tag will happen after this step. Releases don't have a tweak, so this is ok.
27-
run: cmake -DSET_TWEAK=Off .
27+
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
2828

2929
- name: build project
30-
run: cmake --build . -j$(nproc)
30+
run: cmake --build . -j$(nproc) --target package
3131

3232
- name: run fastfetch
3333
run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true
@@ -38,9 +38,6 @@ jobs:
3838
- name: run tests
3939
run: ctest
4040

41-
- name: build deb package
42-
run: sh packaging/deb/create.sh .
43-
4441
- name: perform CodeQL analysis
4542
uses: github/codeql-action/analyze@v1
4643

@@ -60,4 +57,4 @@ jobs:
6057
with:
6158
tag: ${{ steps.get_version_fastfetch.outputs.release }}
6259
commit: ${{ github.sha }}
63-
artifacts: ./fastfetch,./packaging/deb/fastfetch.deb
60+
artifacts: ./fastfetch,./fastfetch-*.*

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,11 @@ project(fastfetch
55
LANGUAGES C
66
)
77

8-
# This is used by github actions for release builds
8+
# This is set to off by github actions for release builds
99
OPTION(SET_TWEAK "Add tweak to project version" ON)
1010

11-
# Track commits between version bumps for output in --version
12-
# Ignored by --version-raw and github actions
13-
if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
14-
execute_process(
15-
COMMAND git describe --tags
16-
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
17-
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
18-
OUTPUT_STRIP_TRAILING_WHITESPACE
19-
)
20-
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK}")
21-
endif()
22-
23-
include(GNUInstallDirs)
11+
# Also create test executables
12+
OPTION(BUILD_TESTS "Build tests" OFF)
2413

2514
OPTION(ENABLE_LIBPCI "Enable libpci" ON)
2615
OPTION(ENABLE_VULKAN "Enable vulkan" ON)
@@ -34,7 +23,17 @@ OPTION(ENABLE_DCONF "Enable dconf" ON)
3423
OPTION(ENABLE_DBUS "Enable dbus-1" ON)
3524
OPTION(ENABLE_XFCONF "Enable libxfconf-0" ON)
3625
OPTION(ENABLE_RPM "Enable rpm" ON)
37-
OPTION(BUILD_TESTS "Build tests" ON)
26+
27+
# Track commits between version bumps for output in --version
28+
if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
29+
execute_process(
30+
COMMAND git describe --tags
31+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
32+
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
33+
OUTPUT_STRIP_TRAILING_WHITESPACE
34+
)
35+
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK}")
36+
endif()
3837

3938
if(NOT CMAKE_BUILD_TYPE)
4039
set(CMAKE_BUILD_TYPE Release)
@@ -66,7 +65,7 @@ find_package(Threads REQUIRED)
6665

6766
find_package(PkgConfig REQUIRED)
6867

69-
# Init CMake targets.
68+
# Init CMake targets
7069

7170
add_library(libfastfetch STATIC
7271
src/util/FFstrbuf.c
@@ -278,7 +277,7 @@ target_link_libraries(flashfetch
278277
PRIVATE libfastfetch
279278
)
280279

281-
# Testing.
280+
# Testing
282281

283282
if (BUILD_TESTS)
284283
add_executable(fastfetch-test-performance
@@ -299,7 +298,9 @@ if (BUILD_TESTS)
299298
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
300299
endif()
301300

302-
# Installation.
301+
# Installation
302+
303+
include(GNUInstallDirs)
303304

304305
install(
305306
TARGETS fastfetch
@@ -321,3 +322,33 @@ install(
321322
FILES ./LICENSE
322323
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}
323324
)
325+
326+
# Packaging
327+
328+
set(CPACK_GENERATOR "DEB;RPM;TZST")
329+
330+
set(CPACK_PACKAGE_CONTACT "Linus Dierheimer <[email protected]>")
331+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Neofetch clone written in C")
332+
set(CPACK_PACKAGE_DESCRIPTION "
333+
fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way.
334+
It is written in c to achieve much better performance.
335+
")
336+
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/LinusDierheimer")
337+
338+
set(CPACK_DEBIAN_PACKAGE_SECTION, "utils")
339+
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
340+
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "
341+
libpci3
342+
libvulkan1
343+
libwayland-client0
344+
libxcb-randr0
345+
xcb
346+
libxrandr2
347+
libx11-6
348+
libdconf1
349+
libglib2.0-0
350+
libdbus-1-3
351+
libxfconf-0-3
352+
")
353+
354+
include(CPack)

packaging/aur

Lines changed: 0 additions & 1 deletion
This file was deleted.

packaging/deb/control-template

Lines changed: 0 additions & 13 deletions
This file was deleted.

packaging/deb/create.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)