Skip to content

Commit

Permalink
Merge branch 'main' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni500github committed Sep 16, 2024
2 parents 3a2f120 + e873f7b commit 12f41ef
Show file tree
Hide file tree
Showing 85 changed files with 5,777 additions and 4,341 deletions.
6 changes: 4 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ TabWidth: 4
UseTab: Never

# Bracing styles
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
Expand All @@ -46,6 +48,8 @@ SpaceInEmptyParentheses: false
SpacesInSquareBrackets: false
IndentAccessModifiers: false
AccessModifierOffset: -4
IndentCaseBlocks: false
IndentCaseLabels: true

# Control formatting of C++11 features
Cpp11BracedListStyle: false
Expand All @@ -60,8 +64,6 @@ ReflowComments: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
BreakBeforeBraces: Allman
IndentCaseLabels: true

AlignConsecutiveShortCaseStatements:
Enabled: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4

- name: create tmp directory
run: mkdir /tmp/customfetch-0.8.6.orig
run: mkdir /tmp/customfetch-0.9.3.orig

- name: Install Packages
run: sudo apt-get update && sudo apt-get install libwayland-dev binutils lintian debhelper devscripts debmake autoconf automake autotools-dev dh-make fakeroot xutils pbuilder -y
Expand All @@ -24,17 +24,17 @@ jobs:

- name: Create deb
run: |
cp -r $GITHUB_WORKSPACE /tmp/customfetch-0.8.6.orig
cd /tmp/customfetch-0.8.6.orig/customfetch
cp -r $GITHUB_WORKSPACE /tmp/customfetch-0.9.3.orig
cd /tmp/customfetch-0.9.3.orig/customfetch
mkdir -p Debian/Debhelper/Buildsystem/
wget https://github.com/Debian/debhelper/raw/master/lib/Debian/Debhelper/Buildsystem/makefile.pm -O Debian/Debhelper/Buildsystem/make.pm
sed -i "s#package Debian::Debhelper::Buildsystem::makefile#package Debian::Debhelper::Buildsystem::make#g" Debian/Debhelper/Buildsystem/make.pm
dpkg-buildpackage -us -uc
- name: Install test cufetch
run: |
cd /tmp/customfetch-0.8.6.orig
sudo dpkg -i customfetch_0.8.6-1_amd64.deb
cd /tmp/customfetch-0.9.3.orig
sudo dpkg -i customfetch_0.9.3-1_amd64.deb
cufetch
build_ubuntu-latest:
Expand Down
118 changes: 105 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,24 @@ jobs:
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
build-tar:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- name: Install Packages
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt upgrade -y
sudo apt-get install build-essential libwayland-dev libarchive-tools -y
- name: Get submodules
uses: actions/checkout@v4
with:
submodules: recursive
sudo apt-get install build-essential g++-10 libwayland-dev libarchive-tools -y
- name: Clean
run: make clean

- name: Compile
run: make DEBUG=0 GUI_MODE=0
run: make DEBUG=0 GUI_MODE=0 CXX=x86_64-linux-gnu-g++-10

- name: Make Release
run: make dist DEBUG=0 && mv ./customfetch-*.tar.gz ./customfetch.tar.gz
Expand All @@ -51,8 +47,8 @@ jobs:
name: customfetch
path: ./customfetch.tar.gz

build-gui:
runs-on: ubuntu-latest
build-gui-tar:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
Expand All @@ -67,12 +63,16 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt upgrade -y
sudo apt-get install build-essential g++-10 libwayland-dev libgtk-3-dev pkg-config libgtkmm-3.0-dev libarchive-tools -y

- name: Clean
run: make clean

- name: Compile
run: make DEBUG=0 GUI_MODE=1
run: make DEBUG=0 GUI_MODE=1 CXX=x86_64-linux-gnu-g++-10

- name: Make Release
run: make dist DEBUG=0 GUI_MODE=1 && mv ./customfetch-*.tar.gz ./customfetch-gui.tar.gz
Expand All @@ -83,9 +83,83 @@ jobs:
name: customfetch-gui
path: ./customfetch-gui.tar.gz

build-deb:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- name: create tmp directory
run: mkdir /tmp/customfetch-0.9.3.orig

- name: Install Packages
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install libwayland-dev libarchive-tools g++-10
sudo apt-get install binutils lintian debhelper devscripts debmake autoconf automake autotools-dev dh-make fakeroot xutils pbuilder -y
- name: Clean
run: make clean

- name: Create deb
run: |
cp -r $GITHUB_WORKSPACE /tmp/customfetch-0.9.3.orig
cd /tmp/customfetch-0.9.3.orig/customfetch
mkdir -p Debian/Debhelper/Buildsystem/
wget https://github.com/Debian/debhelper/raw/master/lib/Debian/Debhelper/Buildsystem/makefile.pm -O Debian/Debhelper/Buildsystem/make.pm
sed -i "s#package Debian::Debhelper::Buildsystem::makefile#package Debian::Debhelper::Buildsystem::make#g" Debian/Debhelper/Buildsystem/make.pm
sed -i "s#DEBUG=0#DEBUG=0 CXX=x86_64-linux-gnu-g++-10#g" debian/rules
dpkg-buildpackage -us -uc
mv ../customfetch_0.9.3-1_amd64.deb ../customfetch_amd64.deb
- name: Upload to github artifacts
uses: actions/upload-artifact@v3
with:
name: customfetch-deb-pkg
path: /tmp/customfetch-0.9.3.orig/customfetch_amd64.deb

build-deb-gui:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- name: create tmp directory
run: mkdir /tmp/customfetch-0.9.3.orig

- name: Install Packages
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install libwayland-dev g++-10 libgtk-3-dev pkg-config libgtkmm-3.0-dev libarchive-tools
sudo apt-get install binutils lintian debhelper devscripts debmake autoconf automake autotools-dev dh-make fakeroot xutils pbuilder -y
- name: Clean
run: make clean

- name: Create deb
run: |
cp -r $GITHUB_WORKSPACE /tmp/customfetch-0.9.3.orig
cd /tmp/customfetch-0.9.3.orig/customfetch
mkdir -p Debian/Debhelper/Buildsystem/
wget https://github.com/Debian/debhelper/raw/master/lib/Debian/Debhelper/Buildsystem/makefile.pm -O Debian/Debhelper/Buildsystem/make.pm
sed -i "s#package Debian::Debhelper::Buildsystem::makefile#package Debian::Debhelper::Buildsystem::make#g" Debian/Debhelper/Buildsystem/make.pm
sed -i "s#GUI_MODE=0#GUI_MODE=1 CXX=x86_64-linux-gnu-g++-10#g" debian/rules
dpkg-buildpackage -us -uc
mv ../customfetch_0.9.3-1_amd64.deb ../customfetch-gui_amd64.deb
- name: Upload to github artifacts
uses: actions/upload-artifact@v3
with:
name: customfetch-gui-deb-pkg
path: /tmp/customfetch-0.9.3.orig/customfetch-gui_amd64.deb

release:
name: Create GitHub Release
needs: [build, build-gui, get-version]
needs: [build-tar, build-gui-tar, build-deb-gui, build-deb, get-version]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -132,3 +206,21 @@ jobs:
asset_path: customfetch-gui/customfetch-gui.tar.gz
asset_name: customfetch-gui-${{ needs.get-version.outputs.version }}.tar.gz
asset_content_type: application/tar+gz

- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.release-url }}
asset_path: customfetch-deb-pkg/customfetch_amd64.deb
asset_name: customfetch_${{ needs.get-version.outputs.version }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package

- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.release-url }}
asset_path: customfetch-gui-deb-pkg/customfetch-gui_amd64.deb
asset_name: customfetch-gui_${{ needs.get-version.outputs.version }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package
58 changes: 43 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
CXX ?= g++
PREFIX ?= /usr
MANPREFIX ?= $(PREFIX)/share/man
APPPREFIX ?= $(PREFIX)/share/applications
VARS ?=
GUI_MODE ?= 0

DEBUG ?= 1
PARSER_TEST ?= 0
GUI_MODE ?= 0
VENDOR_TEST ?= 0
DEVICE_TEST ?= 0

USE_DCONF ?= 1
# https://stackoverflow.com/a/1079861
# WAY easier way to build debug and release builds
ifeq ($(DEBUG), 1)
BUILDDIR = build/debug
CXXFLAGS := -ggdb3 -Wall -Wextra -Wpedantic -DDEBUG=1 $(DEBUG_CXXFLAGS) $(CXXFLAGS)
else
CXXFLAGS := -O3 $(CXXFLAGS)
# Check if an optimization flag is not already set
ifneq ($(filter -O%,$(CXXFLAGS)),)
$(info Keeping the existing optimization flag in CXXFLAGS)
else
CXXFLAGS := -O3 $(CXXFLAGS)
endif
BUILDDIR = build/release
endif

ifeq ($(PARSER_TEST), 1)
VARS += -DPARSER_TEST=1
endif

ifeq ($(VENDOR_TEST), 1)
VARS += -DVENDOR_TEST=1
endif
Expand All @@ -36,12 +39,21 @@ ifeq ($(GUI_MODE), 1)
CXXFLAGS += `pkg-config --cflags gtkmm-3.0`
endif

NAME = customfetch
TARGET = cufetch
VERSION = 0.8.6
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
SRC = $(wildcard src/*.cpp src/query/unix/*.cpp src/query/unix/utils/*.cpp)
OBJ = $(SRC:.cpp=.o)
ifeq ($(USE_DCONF), 1)
ifeq ($(shell pkg-config --exists glib-2.0 dconf && echo 1), 1)
CXXFLAGS += -DUSE_DCONF=1 `pkg-config --cflags glib-2.0 dconf`
else
CXXFLAGS += -DUSE_DCONF=0
endif
endif

NAME = customfetch
TARGET = cufetch
OLDVERSION = 0.9.2
VERSION = 0.9.3
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
SRC = $(wildcard src/*.cpp src/query/unix/*.cpp src/query/unix/utils/*.cpp)
OBJ = $(SRC:.cpp=.o)
LDFLAGS += -L./$(BUILDDIR)/fmt -lfmt -ldl
CXXFLAGS ?= -mtune=generic -march=native
CXXFLAGS += -fvisibility=hidden -Iinclude -std=c++20 $(VARS) -DVERSION=\"$(VERSION)\" -DBRANCH=\"$(BRANCH)\"
Expand All @@ -64,7 +76,7 @@ $(TARGET): fmt toml $(OBJ)
mkdir -p $(BUILDDIR)
$(CXX) $(OBJ) $(BUILDDIR)/toml++/toml.o -o $(BUILDDIR)/$(TARGET) $(LDFLAGS)

dist: $(TARGET)
dist:
bsdtar -zcf $(NAME)-v$(VERSION).tar.gz LICENSE cufetch.1 assets/ascii/ -C $(BUILDDIR) $(TARGET)

clean:
Expand All @@ -82,5 +94,21 @@ install: $(TARGET)
sed -e "s/@VERSION@/$(VERSION)/g" -e "s/@BRANCH@/$(BRANCH)/g" < cufetch.1 > $(DESTDIR)$(MANPREFIX)/man1/cufetch.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/cufetch.1
cd assets/ && find ascii/ -type f -exec install -Dm 644 "{}" "$(DESTDIR)$(PREFIX)/share/customfetch/{}" \;
ifeq ($(GUI_MODE), 1)
mkdir -p $(DESTDIR)$(APPPREFIX)
cp -f cufetch.desktop $(DESTDIR)$(APPPREFIX)
endif

uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET)
rm -f $(DESTDIR)$(MANPREFIX)/man1/cufetch.1
rm -f $(DESTDIR)$(APPPREFIX)/cufetch.desktop
rm -rf $(DESTDIR)$(PREFIX)/share/customfetch/

remove: uninstall
delete: uninstall

updatever:
sed -i "s#$(OLDVERSION)#$(VERSION)#g" $(wildcard .github/workflows/*.yml) compile_flags.txt

.PHONY: $(TARGET) dist distclean fmt toml install all
.PHONY: $(TARGET) updatever remove uninstall delete dist distclean fmt toml install all
Loading

0 comments on commit 12f41ef

Please sign in to comment.