meson: Use Meson over Make

This commit is contained in:
Alastair Poole 2019-12-04 17:47:17 +00:00
parent 5f76337553
commit b09db930af
15 changed files with 34 additions and 2133 deletions

Binary file not shown.

2
data/desktop/meson.build Normal file
View File

@ -0,0 +1,2 @@
install_data('evisum.desktop',
install_dir: join_paths(dir_data, 'applications'))

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

2
data/icons/meson.build Normal file
View File

@ -0,0 +1,2 @@
install_data('evisum.png',
install_dir: join_paths(dir_data, 'icons/hicolor/128x128/apps'))

2
data/meson.build Normal file
View File

@ -0,0 +1,2 @@
subdir('desktop')
subdir('icons')

View File

@ -1,39 +0,0 @@
LIBS=
PREFIX= /usr/local
OSNAME := $(shell uname -s)
ifeq ($(OSNAME), OpenBSD)
LIBS += -lkvm
LDFLAGS += -I/usr/local/include -L/usr/local/lib -L/usr/X11R6/lib
endif
ifeq ($(OSNAME), FreeBSD)
LDFLAGS += -L/usr/local/lib
endif
export PKGS = elementary
export LIBS
export LDFLAGS
default:
$(MAKE) -C src
$(MAKE) -C src/tingle
clean:
$(MAKE) -C src clean
$(MAKE) -C src/tingle clean
install:
$(MAKE) default
-mkdir -p $(PREFIX)/share/
-mkdir -p $(PREFIX)/share/applications
-mkdir -p $(PREFIX)/bin
-mkdir -p $(PREFIX)/share/icons/hicolor/512x512/apps
install -m 0644 data/evisum.png $(PREFIX)/share/icons/hicolor/512x512/apps
install -m 0644 data/evisum.desktop $(PREFIX)/share/applications
install -m 0755 evisum $(PREFIX)/bin
install -m 0755 src/tingle/tingle $(PREFIX)/bin

17
meson.build Normal file
View File

@ -0,0 +1,17 @@
project('evisum', 'c',
version: '0.3.0',
meson_version : '>= 0.40.0')
efl_version = '>= 1.22.0'
deps = dependency('elementary', version: efl_version)
##### dir locations
dir_prefix = get_option('prefix')
dir_bin = join_paths(dir_prefix, get_option('bindir'))
dir_lib = join_paths(dir_prefix, get_option('libdir'))
dir_data = join_paths(dir_prefix, get_option('datadir'))
dir_locale = join_paths(dir_prefix, get_option('localedir'))
subdir('src')
subdir('data')

View File

@ -1,27 +0,0 @@
TARGET = ../evisum
OBJECTS = system.o disks.o process.o ui.o main.o
default: $(TARGET)
$(TARGET) : $(OBJECTS)
$(CC) $(OBJECTS) $(shell pkg-config --libs $(PKGS)) $(LIBS) $(LDFLAGS) -o $@
main.o: main.c
$(CC) -c $(CFLAGS) $(shell pkg-config --cflags $(PKGS)) main.c -o $@
system.o: system.c
$(CC) -c $(CFLAGS) system.c -o $@
disks.o: disks.c
$(CC) -c $(CFLAGS) $(shell pkg-config --cflags $(PKGS)) disks.c -o $@
process.o: process.c
$(CC) -c $(CFLAGS) $(shell pkg-config --cflags $(PKGS)) process.c -o $@
ui.o: ui.c
$(CC) -c $(CFLAGS) $(shell pkg-config --cflags $(PKGS)) ui.c -o $@
clean:
-rm $(OBJECTS)
-rm $(TARGET)

11
src/meson.build Normal file
View File

@ -0,0 +1,11 @@
executable('evisum', [
'disks.c', 'disks.h',
'process.c', 'process.h',
'system.c', 'system.h',
'ui.c', 'ui.h',
'main.c'],
dependencies : deps,
gui_app : true,
install : true)
subdir('tingle')

View File

@ -1,44 +0,0 @@
# UNIX sensors (tingle)
# Query CPU, memory, network, power, audio and
temperature sensors.
Supporting Linux, FreeBSD, OpenBSD, Mac OS and DragonFlyBSD.
It's also probably a useful reference for querying common
system information on the most-common Unix-like operating
systems.
This can be used with pipes by other processes to
query the hardware. Or just to display a status
line in screen or tmux or some Xorg program.
Install:
make (or gmake)
Usage: tingle [OPTIONS]
Where OPTIONS can be a combination of
-c
Show average CPU usage.
-C
Show all CPU cores and usage.
-k (KB) -m (MB) -g (GB)
Show memory usage (unit).
-n
Show network usage.
-p
Show power status (ac and battery percentage).
-t
Show temperature sensors (temperature in celcius).
-a
Display mixer values (system values).
-s
Show all in a nicely formatted status bar format.
This is the default behaviour with no arguments.
With other flags specify (in any order) which
components to display in the status bar.
-h | -help | --help
This help.
Alastair Poole <netstar@gmail.com>

View File

@ -1,23 +0,0 @@
PROGRAM=tingle
SOURCES=tingle.c
CFLAGS=-O2 -Wall -pedantic -std=c99 -lpthread
LDFLAGS=-lm -pthread
HAVE_ALSA := 0
ALSA_TEST := $(shell pkg-config --exists alsa 1>&2 2>/dev/null; echo $$?)
HAVE_ALSA := $(shell if [ $(ALSA_TEST) -eq 0 ]; then echo "true"; else echo "false"; fi)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CFLAGS += -framework CoreAudio
else ifeq ($(UNAME),Linux)
ifeq ($(HAVE_ALSA),true)
CFLAGS += -lasound -DHAVE_ALSA=1
endif
endif
default:
$(CC) $(SOURCES) $(CFLAGS) $(LDFLAGS) -o tingle
clean:
-rm $(PROGRAM)

File diff suppressed because it is too large Load Diff

View File

@ -1,124 +0,0 @@
set-option -g prefix C-j
unbind-key C-b
bind-key b send-prefix
# this is mainly taken from Richo Healey's dotfiles.
# thanks mate.
# TODO
# Finish mapping up all keys
# Learn how splits work
# WISHLIST
# Ideally, update the terminal title/hit the wm for activity on alert
# Statusline
set-window-option -g mode-keys vi # vi key
set-option -g status-keys vi
set -g default-terminal "screen-256color"
# What's the point of vi keys without pane movement?
bind l select-pane -R
bind k select-pane -U
bind j select-pane -D
bind h select-pane -L
bind < resize-pane -L 2
bind > resize-pane -R 2
bind - resize-pane -D 2
bind + resize-pane -U 2
bind ` next-layout
#Ctrl-j-u volume up
bind C-u run-shell -b 'volctl +10'
#Ctrl-j-j volume down
bind C-j run-shell -b 'volctl -10'
# copy mode to escape key
bind y copy-mode
bind ] paste-buffer
bind-key ^] send-keys Escape ":set paste\ri" \; paste-buffer\; send-keys Escape ":set nopaste\r"
#20:03 < micahcowan> rich0_, just in case, something like ^^ [that]
# move tmux copy buffer into x clipboard
bind-key C-y save-buffer /tmp/tmux-buffer \; run-shell "cat /tmp/tmux-buffer | xclip"
# splitting and cycling
unbind %
bind | split-window -h # horizontal split
unbind '"'
bind S split-window -v # vertical split
set-window-option -g automatic-rename off # auto name
# messages
set-window-option -g mode-bg black
set-window-option -g mode-fg white
#set-option -g message-bg nta
#set-option -g message-fg black
# No visual activity
set -g visual-activity off
set -g visual-bell on
set -g status-interval 120
# Less obnoxious colors
set -g pane-active-border-fg black
set -g pane-active-border-bg white
set -g pane-border-fg black
set -g pane-border-bg white
# Richo's screenlike bindings
bind C-n next
bind C-space next
bind space next
bind C-p prev
bind C-d detach
#unbind C-c
bind C-c new-window
bind K confirm-before kill-pane
bind A command-prompt "rename-window '%%'"
# bind M set-window-option monitor-activity (toggle)
# bind _ set-window-option monitor-silence 15 (Toggle)
bind-key C-a last-window
bind-key / command-prompt "split-window -h 'exec man %%'"
bind M set-window-option monitor-activity
bind _ command-prompt "setw monitor-silence '%%'"
bind I set-window-option synchronize-panes
# Create an environment that zsh can make sense of
# set-environment -g tmuxTERM $TERM
set-environment -g INSCREEN yes
# New shells should not inherit pwd
# set -g default-path "."
# status bar
set-option -g status-bg black
set-option -g status-fg white
set-option -g message-attr none
set-option -g message-bg black
set-option -g message-fg white
set-window-option -g window-status-bell-bg black
set-window-option -g window-status-bell-attr bright
set-window-option -g window-status-activity-bg red
set-window-option -g window-status-activity-attr bright
set-option -g status-interval 5
set-option -g status-right-length 90
set-option -g status-right "#[fg=colour255]#(tingle -s -c -m -a -p) #(date +'%H:%M %d-%m-%Y')"
# Cheers Nei on freenode
set-window-option -g window-status-current-format "[#[fg=white]#I:#W#F#[fg=red]]"
set-option -g visual-activity on
set-window-option -g monitor-activity off
set-window-option -g window-status-current-fg red
set-window-option -g window-status-current-attr bright
# DEBUG
# bind r source ~/.tmux.conf
# clock
set-window-option -g clock-mode-colour black
set-window-option -g clock-mode-style 24
# vim: ft=tmux

View File

@ -1,142 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
my $OS = $^O;
sub Error {
my ($str) = @_;
print STDERR "Error: $str\n";
exit (0 << 1);
}
sub mixer_levels_get {
my ($left, $right) = @_;
my $pipe_cmd = "";
if ($OS eq "openbsd" || $OS eq "netbsd")
{
$pipe_cmd = "mixerctl outputs.master|";
}
elsif ($OS eq "freebsd" || $OS eq "dragonfly")
{
$pipe_cmd = "mixer vol|";
}
elsif ($OS eq "darwin")
{
$pipe_cmd = "osascript -e 'get volume settings'|";
}
elsif ($OS eq "linux")
{
$pipe_cmd = "amixer get Master|";
}
open P, "$pipe_cmd" || die "Unable to determine mixer!\n";
my @lines = <P>;
close P;
my $have_mixer = 0;
foreach my $line (@lines)
{
if ($line =~ m/Left:.*\[(\d+)%\]/)
{
$$left = $1;
$have_mixer = 1;
}
if ($line =~ m/Right:.*\[(\d+)%\]/)
{
$$right = $1;
$have_mixer = 1;
}
if ($line =~ m/\Aoutput\svolume:(\d+),/)
{
$$left = $$right = $1;
return 1;
}
elsif ($line =~ m/(\d+),(\d+)/ || $line =~ m/(\d+):(\d+)/)
{
$$left = $1;
$$right = $2;
return 1;
}
}
return $have_mixer;
}
sub mixer_levels_set {
my ($new_left, $new_right) = @_;
my $cmd = "";
close (STDOUT);
if ($OS eq "openbsd" || $OS eq "netbsd")
{
$cmd = "mixerctl outputs.master=$new_left,$new_right";
}
elsif ($OS eq "freebsd" || $OS eq "dragonfly")
{
$cmd = "mixer $new_left:$new_right"
}
elsif ($OS eq "darwin")
{
my $greatest = $new_left > $new_right ? $new_left : $new_right;
my $ratio = 7 / 100;
my $volume = $greatest * $ratio;
$cmd = "osascript -e 'set volume $volume'";
}
elsif ($OS eq "linux")
{
my $greatest = $new_left > $new_right ? $new_left : $new_right;
$cmd = "amixer set \"Master\" $greatest%";
}
return system($cmd);
}
sub main {
my (@args) = @_;
my $argc = scalar(@args);
my ($inc, $dec) = (0, 0);
my ($left, $right) = (0, 0);
for (my $i = 0; $i < $argc; $i++)
{
if ($args[$i] =~ /\+(\d+)/)
{
$inc = $1;
}
if ($args[$i] =~ /\-(\d+)/)
{
$dec = $1
}
}
if (!mixer_levels_get(\$left, \$right))
{
Error("couldn't get current volumes");
}
$left -= $dec; $right -= $dec;
$left += $inc; $right += $inc;
if ($OS eq "linux" || $OS eq "darwin" || $OS eq "freebsd" || $OS eq "dragonfly")
{
if ($left < 0) { $left = 0; };
if ($left > 100) { $left = 100; };
if ($right < 0) { $right = 0; };
if ($right > 100) { $right = 100 };
}
return mixer_levels_set($left, $right);
}
exit(main(@ARGV));