reorg makefile and make runtime locations less messy
In particular, stop using the installation directory for anything and instead move to /opt/rosenrot The user specific cache remains at /home/user/.cache
3
config.h
|
@ -18,8 +18,9 @@
|
||||||
#define SEARCH "https://search.nunosempere.com/search?q=%s"
|
#define SEARCH "https://search.nunosempere.com/search?q=%s"
|
||||||
// #define SEARCH "https://lite.duckduckgo.com/html/?q=%s"
|
// #define SEARCH "https://lite.duckduckgo.com/html/?q=%s"
|
||||||
#define HOME ""
|
#define HOME ""
|
||||||
|
// ^ Could also be a website ("https://search.nunosempere.com"), or a file ("file:///opt/rose/homepage.png")
|
||||||
// #define HOME "https://search.nunosempere.com/"
|
// #define HOME "https://search.nunosempere.com/"
|
||||||
// #define HOME "file:///home/nuno/Documents/workspace/rosenrot/user-scripts/debian-12/rose-images/rose-homepage-2.png"
|
// #define HOME "file:///opt/rosenrot/rose.png"
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
#define LIBRE_REDIRECT_ENABLED true
|
#define LIBRE_REDIRECT_ENABLED true
|
||||||
|
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 474 KiB After Width: | Height: | Size: 474 KiB |
1
images/flower-imgs/rose-src.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
https://www.onlygfx.com/red-rose-png-image-transparent/
|
Before Width: | Height: | Size: 474 KiB After Width: | Height: | Size: 474 KiB |
BIN
images/flower-imgs/rose2.png
Normal file
After Width: | Height: | Size: 111 KiB |
Before Width: | Height: | Size: 739 KiB After Width: | Height: | Size: 739 KiB |
77
makefile
|
@ -1,10 +1,9 @@
|
||||||
# C compiler
|
# C compiler
|
||||||
CC=gcc # other options: tcc, clang, zig cc
|
CC=gcc # alternatives: tcc, clang, zig cc
|
||||||
WARNINGS=-Wall
|
WARNINGS=-Wall
|
||||||
DEBUG=#'-g'
|
DEBUG= # -g
|
||||||
OPTIMIZED_SOME=-O3
|
OPTIMIZED_SOME=-O3
|
||||||
OPTIMIZED_MORE=-Ofast -march=native -funit-at-a-time -flto # binary will not be compatible with other computers, but may be much faster
|
OPTIMIZED_MORE=-Ofast -march=native -funit-at-a-time -flto # binary will not be compatible with other computers, but may be much faster
|
||||||
# COMPILETIME_DEPRECATION_WARNINGS=#-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED # turns out that webkit2gtk-4.1 is using some deprecated stuff, lol
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
DEPS='webkit2gtk-4.1'
|
DEPS='webkit2gtk-4.1'
|
||||||
|
@ -15,62 +14,50 @@ LIBS=`pkg-config --libs ${DEPS}`
|
||||||
SRC=rosenrot.c
|
SRC=rosenrot.c
|
||||||
CONFIG=config.h
|
CONFIG=config.h
|
||||||
|
|
||||||
## Plugins
|
# Plugins
|
||||||
LIBRE_REDIRECT=./plugins/libre_redirect/libre_redirect.c ./plugins/libre_redirect/str_replace_start.c ./plugins/libre_redirect/str_init.c
|
# include plugins/plugins.mk
|
||||||
CUSTOM_STYLES=./plugins/style/style.c
|
PLUGINS=./plugins/stand_in/stand_in.c
|
||||||
READABILITY=./plugins/readability/readability.c
|
|
||||||
SHORTCUTS=./plugins/shortcuts/shortcuts.c
|
|
||||||
STAND_IN=./plugins/stand_in/stand_in.c # gives function definitions for the above, which do nothing
|
|
||||||
PLUGINS=$(LIBRE_REDIRECT) $(READABILITY) $(CUSTOM_STYLES) $(SHORTCUTS)
|
|
||||||
ADBLOCK='-L/usr/lib/wyebrowser/adblock.so' ## optional adblocking; depends on https://github.com/jun7/wyebadblock
|
|
||||||
|
|
||||||
## Formatter
|
## Formatter
|
||||||
STYLE_BLUEPRINT=webkit
|
STYLE_BLUEPRINT=webkit
|
||||||
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
||||||
|
|
||||||
# Change hardcoded paths when building
|
# Runtime files
|
||||||
## Data dirs
|
MAINTAINER_CACHE_DIR=/home/nuno/.cache/rosenrot
|
||||||
USER=`whoami`
|
USER_CACHE_DIR=/home/`whoami`/.cache/rosenrot
|
||||||
DEFAULT_DATA_DIR=/home/nuno/.cache/rosenrot
|
RUNTIME_FILES_DIR=/opt/rosenrot/
|
||||||
USER_DATA_DIR=/home/$(USER)/.cache/rosenrot
|
|
||||||
## Startup image dir
|
|
||||||
DEFAULT_DIR=/home/nuno/Documents/workspace/rosenrot
|
|
||||||
CURRENT_DIR=`pwd`
|
|
||||||
|
|
||||||
build: $(SRC) $(PLUGINS) $(CONFIG)
|
build: $(SRC) $(PLUGINS) $(CONFIG) constants user_cache
|
||||||
# Recompute constants
|
|
||||||
cd plugins/readability/ && sh recompute_READABILITY_N.sh
|
|
||||||
cd plugins/style && sh recompute_STYLE_N.sh
|
|
||||||
# Make cache
|
|
||||||
mkdir -p $(USER_DATA_DIR)
|
|
||||||
# Hardcode cache path
|
|
||||||
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
|
||||||
sed -i "s|$(DEFAULT_DATA_DIR)|$(USER_DATA_DIR)|g" {} +
|
|
||||||
# Hardcode git repository path
|
|
||||||
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
|
||||||
sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} +
|
|
||||||
# Compile rosenrot
|
|
||||||
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
|
|
||||||
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
|
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
|
||||||
|
|
||||||
install: rosenrot
|
constants:
|
||||||
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
|
cd plugins/readability/ && sh recompute_READABILITY_N.sh
|
||||||
|
cd plugins/style && sh recompute_STYLE_N.sh
|
||||||
|
|
||||||
|
user_cache:
|
||||||
|
@ # can't make this with sudo, because USER_CACHE_DIR could be /home/root/.cache
|
||||||
|
mkdir -p $(USER_CACHE_DIR)
|
||||||
|
find . -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
||||||
|
sed -i "s|$(MAINTAINER_CACHE_DIR)|$(USER_CACHE_DIR)|g" {} +
|
||||||
|
|
||||||
|
runtime_files:
|
||||||
|
sudo mkdir -p /opt/rosenrot/
|
||||||
|
sudo cp style.css /opt/rosenrot/
|
||||||
|
sudo cp -r images/flower-imgs /opt/rosenrot/
|
||||||
|
|
||||||
|
install: rosenrot runtime_files
|
||||||
cp -f rosenrot /usr/bin
|
cp -f rosenrot /usr/bin
|
||||||
mkdir -p /usr/share/themes/rosenrot
|
|
||||||
cp style.css /usr/share/themes/rosenrot/
|
|
||||||
cp rosenrot-mklink /usr/bin
|
cp rosenrot-mklink /usr/bin
|
||||||
sudo mkdir -p /usr/bin/rosenrot-browser
|
|
||||||
sudo cp rosenrot /usr/bin/rosenrot-browser/twitter # custom twitter tweaks
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -r /usr/share/themes/rosenrot
|
rm -r /opt/rosenrot
|
||||||
rm /usr/bin/rosenrot
|
rm /usr/bin/rosenrot
|
||||||
rm /usr/bin/rosenrot-mklink
|
rm /usr/bin/rosenrot-mklink
|
||||||
rm $(DATA_DIR)
|
rm $(USER_CACHE_DIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm rosenrot
|
rm rosenrot
|
||||||
rm $(DATA_DIR)
|
rm $(USER_CACHE_DIR)
|
||||||
|
|
||||||
format: $(SRC) $(PLUGINS)
|
format: $(SRC) $(PLUGINS)
|
||||||
$(FORMATTER) $(SRC) $(PLUGINS) $(rosenrot.h)
|
$(FORMATTER) $(SRC) $(PLUGINS) $(rosenrot.h)
|
||||||
|
@ -98,3 +85,9 @@ diagnose_deprecations:
|
||||||
|
|
||||||
view-gtk3-version:
|
view-gtk3-version:
|
||||||
dpkg -l libgtk-3-0
|
dpkg -l libgtk-3-0
|
||||||
|
|
||||||
|
twitter:
|
||||||
|
sudo mkdir -p /usr/bin/rosenrot-browser
|
||||||
|
sudo cp rosenrot /usr/bin/rosenrot-browser/twitter
|
||||||
|
|
||||||
|
# COMPILETIME_DEPRECATION_WARNINGS=#-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED # turns out that webkit2gtk-4.1 is using some deprecated stuff, lol
|
||||||
|
|
14
plugins/plugins.mk
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
## Plugins
|
||||||
|
CUSTOM_STYLES=./plugins/style/style.c
|
||||||
|
SHORTCUTS=./plugins/shortcuts/shortcuts.c
|
||||||
|
READABILITY=./plugins/readability/readability.c
|
||||||
|
LIBRE_REDIRECT=./plugins/libre_redirect/libre_redirect.c ./plugins/libre_redirect/str_replace_start.c ./plugins/libre_redirect/str_init.c
|
||||||
|
|
||||||
|
ADBLOCK='-L/usr/lib/wyebrowser/adblock.so' # optional adblocking; depends on https://github.com/jun7/wyebadblock
|
||||||
|
|
||||||
|
STAND_IN=./plugins/stand_in/stand_in.c # gives function definitions for the above, which do nothing
|
||||||
|
|
||||||
|
PLUGINS=$(CUSTOM_STYLES) $(SHORTCUTS) $(READABILITY) $(LIBRE_REDIRECT)
|
||||||
|
# PLUGINS=$(STAND_IN)
|
||||||
|
|
||||||
|
|
|
@ -25,3 +25,6 @@ void read_style_js(char* string){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shortcut_expand(const char* uri, char* output){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -21,3 +21,4 @@ void read_readability_js(char* string);
|
||||||
|
|
||||||
void read_style_js(char* string);
|
void read_style_js(char* string);
|
||||||
|
|
||||||
|
int shortcut_expand(const char* uri, char* output);
|
||||||
|
|
|
@ -414,7 +414,7 @@ int main(int argc, char** argv)
|
||||||
gtk_init(NULL, NULL); // <https://docs.gtk.org/gtk3/func.init.html>
|
gtk_init(NULL, NULL); // <https://docs.gtk.org/gtk3/func.init.html>
|
||||||
g_object_set(gtk_settings_get_default(), GTK_SETTINGS_CONFIG_H, NULL); // <https://docs.gtk.org/gobject/method.Object.set.html>
|
g_object_set(gtk_settings_get_default(), GTK_SETTINGS_CONFIG_H, NULL); // <https://docs.gtk.org/gobject/method.Object.set.html>
|
||||||
GtkCssProvider* css = gtk_css_provider_new();
|
GtkCssProvider* css = gtk_css_provider_new();
|
||||||
gtk_css_provider_load_from_path(css, "/usr/share/themes/rosenrot/style.css", NULL);
|
gtk_css_provider_load_from_path(css, "/opt/rosenrot/style.css", NULL);
|
||||||
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(css), 800);
|
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(css), 800);
|
||||||
|
|
||||||
/* Initialize GTK objects. These are declared as static globals at the top of this file */
|
/* Initialize GTK objects. These are declared as static globals at the top of this file */
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
* {
|
* {
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
/*@Base; */
|
color: #333;
|
||||||
/* border-bottom-color: @Base; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make titlebar pretty gigantic. I'm pretty myopic. */
|
/* Make titlebar pretty gigantic. I'm pretty myopic. */
|
||||||
|
|
|
@ -23,6 +23,8 @@ cd -
|
||||||
# Debian desktop icon
|
# Debian desktop icon
|
||||||
chmod +x rosenrot.desktop
|
chmod +x rosenrot.desktop
|
||||||
sudo cp rosenrot.desktop /usr/share/applications
|
sudo cp rosenrot.desktop /usr/share/applications
|
||||||
|
mkdir -p /opt/rosenrot
|
||||||
|
sudo cp rosenrot-desktop-icon.png /opt/rosenrot/
|
||||||
|
|
||||||
# Optionally, set a shortcut (within GNOME)
|
# Optionally, set a shortcut (within GNOME)
|
||||||
# https://askubuntu.com/questions/597395/how-to-set-custom-keyboard-shortcuts-from-terminal/1007035#1007035
|
# https://askubuntu.com/questions/597395/how-to-set-custom-keyboard-shortcuts-from-terminal/1007035#1007035
|
||||||
|
|
Before Width: | Height: | Size: 625 KiB |
Before Width: | Height: | Size: 102 KiB |
|
@ -1 +0,0 @@
|
||||||
<https://www.onlygfx.com/red-rose-png-image-transparent/>
|
|
BIN
user-scripts/debian-12/rosenrot-desktop-icon.png
Normal file
After Width: | Height: | Size: 739 KiB |
|
@ -6,4 +6,4 @@ Terminal=false
|
||||||
Exec=/bin/rose %u
|
Exec=/bin/rose %u
|
||||||
Name=Rose
|
Name=Rose
|
||||||
Comment=Minimalistic browser
|
Comment=Minimalistic browser
|
||||||
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/debian-12/rose-images/rose-desktop-icon.png
|
Icon=/opt/rosenrot/rosenrot-desktop-icon.png
|
||||||
|
|