Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create build script, update icons, update .desktop file, bump rev. #9

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
112 changes: 112 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash

# Copyright (c) 2022 Alex313031.

YEL='\033[1;33m' # Yellow
CYA='\033[1;96m' # Cyan
RED='\033[1;31m' # Red
GRE='\033[1;32m' # Green
c0='\033[0m' # Reset Text
bold='\033[1m' # Bold Text
underline='\033[4m' # Underline Text

# Error handling
yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 111; }
try() { "$@" || die "${RED}Failed $*"; }

# --help
displayHelp () {
printf "\n" &&
printf "${bold}${GRE}Script to build xsensors on Linux.${c0}\n" &&
printf "${YEL}Use the --clean flag to run make clean. (should be run when rebuilding)\n" &&
printf "${YEL}Use the --gtk2 flag to build with GTK2.\n" &&
printf "${YEL}Use the --gtk3 flag to build with GTK3.\n" &&
printf "${YEL}Use the --help flag to show this help.\n" &&
tput sgr0 &&
printf "\n"
}

case $1 in
--help) displayHelp; exit 0;;
esac

printf "\n" &&
printf "${bold}${GRE}Script to build xsensors on Linux.${c0}\n" &&
printf "${YEL}Building xsensors...${c0}\n" &&

# Export optimization flags
export NINJA_SUMMARIZE_BUILD=1 &&

export CFLAGS="-DNDEBUG -O3 -msse3 -g0 -s"
export CPPFLAGS="-DNDEBUG -O3 -msse3 -g0 -s"
export CXXFLAGS="-DNDEBUG -O3 -msse3 -g0 -s"
export GLIB_CFLAGS="-DNDEBUG -O3 -msse3 -g0 -s"
export GTK_LIBS="-DNDEBUG -O3 -msse3 -g0 -s"
export GTK_CFLAGS="-DNDEBUG -O3 -msse3 -g0 -s"
export XSENSORS_CFLAGS="-DNDEBUG -O3 -msse3 -g0 -s"
export LDFLAGS="-Wl,-O3 -msse3 -s"

# --clean
makeClean () {
printf "${CYA}\n" &&
make clean &&
make distclean &&
printf "\n" &&
printf "${bold}${GRE}Build dir cleaned.${c0}\n" &&
printf "\n"
}

case $1 in
--clean) makeClean; exit 0;;
esac

# --gtk2
makeGTK2 () {
printf "\n" &&
printf "${bold}${GRE}Building with GTK2...${c0}\n" &&
printf "${CYA}\n" &&
./autogen.sh &&

./configure --with-gtk2 --disable-debug &&

make VERBOSE=1 V=1
printf "${c0}\n" &&
printf "${GRE}${bold}Build Completed. ${YEL}${bold}You can now sudo make install or make install to install it.\n" &&
printf "${GRE}(sudo make uninstall or make uninstall to uninstall it)\n" &&
printf "\n" &&
tput sgr0
}

case $1 in
--gtk2) makeGTK2; exit 0;;
esac

# --gtk3
makeGTK3 () {
printf "\n" &&
printf "${bold}${GRE}Building with GTK3...${c0}\n" &&
printf "${CYA}\n" &&
./autogen.sh &&

./configure --disable-debug &&

make VERBOSE=1 V=1 &&
printf "${c0}\n" &&
printf "${GRE}${bold}Build Completed. ${YEL}${bold}You can now sudo make install or make install to install it.\n" &&
printf "${GRE}(sudo make uninstall or make uninstall to uninstall it)\n" &&
printf "\n" &&
tput sgr0
}

case $1 in
--gtk3) makeGTK3; exit 0;;
esac

# Error message if no flag is supplied.
printf "${bold}${RED}Error: Must supply --gtk2, --gtk3, and/or --clean.\n" &&
printf "${bold}${YEL}Run this script with --help to display full help message.\n" &&
printf "\n" &&
tput sgr0 &&

exit 1
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for xsensors 0.80.
# Generated by GNU Autoconf 2.69 for xsensors 0.82.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xsensors'
PACKAGE_TARNAME='xsensors'
PACKAGE_VERSION='0.80'
PACKAGE_STRING='xsensors 0.80'
PACKAGE_VERSION='0.82'
PACKAGE_STRING='xsensors 0.82'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1288,7 +1288,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures xsensors 0.80 to adapt to many kinds of systems.
\`configure' configures xsensors 0.82 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1354,7 +1354,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of xsensors 0.80:";;
short | recursive ) echo "Configuration of xsensors 0.82:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1463,7 +1463,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
xsensors configure 0.80
xsensors configure 0.82
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1761,7 +1761,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by xsensors $as_me 0.80, which was
It was created by xsensors $as_me 0.82, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -2625,7 +2625,7 @@ fi

# Define the identity of the package.
PACKAGE='xsensors'
VERSION='0.80'
VERSION='0.82'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -5632,7 +5632,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by xsensors $as_me 0.80, which was
This file was extended by xsensors $as_me 0.82, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -5698,7 +5698,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
xsensors config.status 0.80
xsensors config.status 0.82
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.

AM_CONFIG_HEADER(config.h)

AC_INIT(xsensors, 0.80)
AC_INIT(xsensors, 0.82)
AC_CONFIG_SRCDIR(src/main.c)
AM_INIT_AUTOMAKE

Expand Down
16 changes: 15 additions & 1 deletion src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ gint destroy_gui( GtkWidget *widget, gpointer data )
return (FALSE);
}

/* Quit app on Escape key press */
gboolean on_key_press_callback(GtkWidget *widget, GdkEventKey *event, gpointer data){
switch(event->keyval){
case GDK_KEY_q:
gtk_main_quit();
break;
}
return FALSE;
}

/* About Dialog */
gboolean about_callback( GtkWidget *widget, GdkEvent *event )
{
char* authors [6] = {"Kris Kersey",
char* authors [7] = {"Kris Kersey",
"Jean Delvare",
"Joaquim Fellmann",
"Jeremy Newton (mystro256)",
"with patches from Nanley Chery",
"and Alexander Frick",
NULL};

gtk_show_about_dialog( GTK_WINDOW (mainwindow),
Expand Down Expand Up @@ -697,6 +708,9 @@ int start_gui( int argc, char **argv )
G_CALLBACK (about_callback), NULL );
gtk_widget_show( tempwgt );

g_signal_connect( G_OBJECT (mainwindow), "key_press_event",
G_CALLBACK (on_key_press_callback), NULL);

tempwgt = gtk_menu_item_new_with_label( "Quit" );
gtk_menu_shell_append( GTK_MENU_SHELL (menubar), tempwgt );
g_signal_connect( tempwgt, "activate",
Expand Down
3 changes: 2 additions & 1 deletion src/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum { VOLT, TEMP, FAN };

#define NA "Not Available!"

#define COPYRIGHT "© 2012-2016 Jeremy Newton, 2002-2007 Kris Kersey"
#define COPYRIGHT "© 2012-2023 Jeremy Newton, 2002-2007 Kris Kersey"

#define GPL2PLUS \
"This program is free software; you can redistribute it and/or modify\n"\
Expand Down Expand Up @@ -58,6 +58,7 @@ gboolean draw_callback( GtkWidget *, GdkEventExpose *, gpointer );
gboolean draw_callback( GtkWidget *, cairo_t *, gpointer );
#endif
gboolean about_callback( GtkWidget *, GdkEvent * );
gboolean on_key_press_callback( GtkWidget *, GdkEventKey *, gpointer );
gint start_timer( GtkWidget *, gpointer );
void get_pm_location( gchar, int *, int *, int * );
int start_gui( int, char ** );
15 changes: 15 additions & 0 deletions xdg/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ pixmapdir = $(datadir)/xsensors
pixmap_DATA = \
theme.png

icon16dir = $(datadir)/icons/hicolor/16x16/apps/

icon16_DATA = \
icons/16x16/xsensors.png

icon24dir = $(datadir)/icons/hicolor/24x24/apps/

icon24_DATA = \
icons/24x24/xsensors.png

icon32dir = $(datadir)/icons/hicolor/32x32/apps/

icon32_DATA = \
icons/32x32/xsensors.png

icon48dir = $(datadir)/icons/hicolor/48x48/apps/

icon48_DATA = \
Expand Down
Loading