diff options
author | NunoSempere <nuno.semperelh@protonmail.com> | 2024-03-14 19:31:04 -0300 |
---|---|---|
committer | NunoSempere <nuno.semperelh@protonmail.com> | 2024-03-14 19:31:04 -0300 |
commit | af208844b575edb6ce9205507289a00743a8bf4e (patch) | |
tree | c36ebd9e175a4d60a1b31d0f94f085a9d1f90aae | |
parent | 878d6a890bdc1a8381b0c44c80c36d829cc28fc1 (diff) |
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
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | images/flower-imgs/rose-homepage-2.png (renamed from user-scripts/debian-12/rose-images/rose-homepage-2.png) | bin | 145422 -> 145422 bytes | |||
-rw-r--r-- | images/flower-imgs/rose-homepage.png (renamed from user-scripts/debian-12/rose-images/rose-homepage.png) | bin | 485022 -> 485022 bytes | |||
-rw-r--r-- | images/flower-imgs/rose-src.txt | 1 | ||||
-rw-r--r-- | images/flower-imgs/rose.png (renamed from user-scripts/debian-12/rose-images/rose-2.png) | bin | 485022 -> 485022 bytes | |||
-rw-r--r-- | images/flower-imgs/rose2.png | bin | 0 -> 113204 bytes | |||
-rw-r--r-- | images/flower-imgs/rosenrot-desktop-icon.png (renamed from user-scripts/debian-12/rose-images/rose-desktop-icon.png) | bin | 756923 -> 756923 bytes | |||
-rw-r--r-- | makefile | 77 | ||||
-rw-r--r-- | plugins/plugins.mk | 14 | ||||
-rw-r--r-- | plugins/stand_in/stand_in.c | 3 | ||||
-rw-r--r-- | plugins/stand_in/stand_in.h | 1 | ||||
-rwxr-xr-x | rosenrot | bin | 40216 -> 35536 bytes | |||
-rw-r--r-- | rosenrot.c | 2 | ||||
-rw-r--r-- | style.css | 3 | ||||
-rw-r--r-- | user-scripts/debian-12/install-with-dependencies.sh | 2 | ||||
-rw-r--r-- | user-scripts/debian-12/rose-images/rose-1.png | bin | 640116 -> 0 bytes | |||
-rw-r--r-- | user-scripts/debian-12/rose-images/rose-homepage-1.6-zoom.png | bin | 104014 -> 0 bytes | |||
-rw-r--r-- | user-scripts/debian-12/rose-images/rose-src.txt | 1 | ||||
-rw-r--r-- | user-scripts/debian-12/rosenrot-desktop-icon.png | bin | 0 -> 756923 bytes | |||
-rwxr-xr-x | user-scripts/debian-12/rosenrot.desktop | 2 |
20 files changed, 61 insertions, 48 deletions
@@ -18,8 +18,9 @@ #define SEARCH "https://search.nunosempere.com/search?q=%s" // #define SEARCH "https://lite.duckduckgo.com/html/?q=%s" #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 "file:///home/nuno/Documents/workspace/rosenrot/user-scripts/debian-12/rose-images/rose-homepage-2.png" +// #define HOME "file:///opt/rosenrot/rose.png" // Plugins #define LIBRE_REDIRECT_ENABLED true diff --git a/user-scripts/debian-12/rose-images/rose-homepage-2.png b/images/flower-imgs/rose-homepage-2.png Binary files differindex 2770c78..2770c78 100644 --- a/user-scripts/debian-12/rose-images/rose-homepage-2.png +++ b/images/flower-imgs/rose-homepage-2.png diff --git a/user-scripts/debian-12/rose-images/rose-homepage.png b/images/flower-imgs/rose-homepage.png Binary files differindex 9944beb..9944beb 100644 --- a/user-scripts/debian-12/rose-images/rose-homepage.png +++ b/images/flower-imgs/rose-homepage.png diff --git a/images/flower-imgs/rose-src.txt b/images/flower-imgs/rose-src.txt new file mode 100644 index 0000000..b41762d --- /dev/null +++ b/images/flower-imgs/rose-src.txt @@ -0,0 +1 @@ +https://www.onlygfx.com/red-rose-png-image-transparent/ diff --git a/user-scripts/debian-12/rose-images/rose-2.png b/images/flower-imgs/rose.png Binary files differindex 9944beb..9944beb 100644 --- a/user-scripts/debian-12/rose-images/rose-2.png +++ b/images/flower-imgs/rose.png diff --git a/images/flower-imgs/rose2.png b/images/flower-imgs/rose2.png Binary files differnew file mode 100644 index 0000000..6ab0658 --- /dev/null +++ b/images/flower-imgs/rose2.png diff --git a/user-scripts/debian-12/rose-images/rose-desktop-icon.png b/images/flower-imgs/rosenrot-desktop-icon.png Binary files differindex 163494f..163494f 100644 --- a/user-scripts/debian-12/rose-images/rose-desktop-icon.png +++ b/images/flower-imgs/rosenrot-desktop-icon.png @@ -1,10 +1,9 @@ # C compiler -CC=gcc # other options: tcc, clang, zig cc +CC=gcc # alternatives: tcc, clang, zig cc WARNINGS=-Wall -DEBUG=#'-g' +DEBUG= # -g 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 -# COMPILETIME_DEPRECATION_WARNINGS=#-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED # turns out that webkit2gtk-4.1 is using some deprecated stuff, lol # Dependencies DEPS='webkit2gtk-4.1' @@ -15,62 +14,50 @@ LIBS=`pkg-config --libs ${DEPS}` SRC=rosenrot.c CONFIG=config.h -## Plugins -LIBRE_REDIRECT=./plugins/libre_redirect/libre_redirect.c ./plugins/libre_redirect/str_replace_start.c ./plugins/libre_redirect/str_init.c -CUSTOM_STYLES=./plugins/style/style.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 +# Plugins +# include plugins/plugins.mk +PLUGINS=./plugins/stand_in/stand_in.c ## Formatter STYLE_BLUEPRINT=webkit FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) -# Change hardcoded paths when building -## Data dirs -USER=`whoami` -DEFAULT_DATA_DIR=/home/nuno/.cache/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) - # Recompute constants +# Runtime files +MAINTAINER_CACHE_DIR=/home/nuno/.cache/rosenrot +USER_CACHE_DIR=/home/`whoami`/.cache/rosenrot +RUNTIME_FILES_DIR=/opt/rosenrot/ + +build: $(SRC) $(PLUGINS) $(CONFIG) constants user_cache + $(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK) + +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) -install: rosenrot - GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/ +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 - mkdir -p /usr/share/themes/rosenrot - cp style.css /usr/share/themes/rosenrot/ cp rosenrot-mklink /usr/bin - sudo mkdir -p /usr/bin/rosenrot-browser - sudo cp rosenrot /usr/bin/rosenrot-browser/twitter # custom twitter tweaks uninstall: - rm -r /usr/share/themes/rosenrot + rm -r /opt/rosenrot rm /usr/bin/rosenrot rm /usr/bin/rosenrot-mklink - rm $(DATA_DIR) + rm $(USER_CACHE_DIR) clean: rm rosenrot - rm $(DATA_DIR) + rm $(USER_CACHE_DIR) format: $(SRC) $(PLUGINS) $(FORMATTER) $(SRC) $(PLUGINS) $(rosenrot.h) @@ -98,3 +85,9 @@ diagnose_deprecations: view-gtk3-version: 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 diff --git a/plugins/plugins.mk b/plugins/plugins.mk new file mode 100644 index 0000000..f95cac7 --- /dev/null +++ b/plugins/plugins.mk @@ -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) + + diff --git a/plugins/stand_in/stand_in.c b/plugins/stand_in/stand_in.c index dbcc7e8..cb8c487 100644 --- a/plugins/stand_in/stand_in.c +++ b/plugins/stand_in/stand_in.c @@ -25,3 +25,6 @@ void read_style_js(char* string){ } +int shortcut_expand(const char* uri, char* output){ + return 0; +} diff --git a/plugins/stand_in/stand_in.h b/plugins/stand_in/stand_in.h index 062acf7..10f4283 100644 --- a/plugins/stand_in/stand_in.h +++ b/plugins/stand_in/stand_in.h @@ -21,3 +21,4 @@ void read_readability_js(char* string); void read_style_js(char* string); +int shortcut_expand(const char* uri, char* output); Binary files differ@@ -414,7 +414,7 @@ int main(int argc, char** argv) 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> 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); /* Initialize GTK objects. These are declared as static globals at the top of this file */ @@ -1,7 +1,6 @@ * { font-size: 25px; - /*@Base; */ - /* border-bottom-color: @Base; */ + color: #333; } /* Make titlebar pretty gigantic. I'm pretty myopic. */ diff --git a/user-scripts/debian-12/install-with-dependencies.sh b/user-scripts/debian-12/install-with-dependencies.sh index e1aa254..687c376 100644 --- a/user-scripts/debian-12/install-with-dependencies.sh +++ b/user-scripts/debian-12/install-with-dependencies.sh @@ -23,6 +23,8 @@ cd - # Debian desktop icon chmod +x rosenrot.desktop 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) # https://askubuntu.com/questions/597395/how-to-set-custom-keyboard-shortcuts-from-terminal/1007035#1007035 diff --git a/user-scripts/debian-12/rose-images/rose-1.png b/user-scripts/debian-12/rose-images/rose-1.png Binary files differdeleted file mode 100644 index f2c546a..0000000 --- a/user-scripts/debian-12/rose-images/rose-1.png +++ /dev/null diff --git a/user-scripts/debian-12/rose-images/rose-homepage-1.6-zoom.png b/user-scripts/debian-12/rose-images/rose-homepage-1.6-zoom.png Binary files differdeleted file mode 100644 index 97183ac..0000000 --- a/user-scripts/debian-12/rose-images/rose-homepage-1.6-zoom.png +++ /dev/null diff --git a/user-scripts/debian-12/rose-images/rose-src.txt b/user-scripts/debian-12/rose-images/rose-src.txt deleted file mode 100644 index 30650de..0000000 --- a/user-scripts/debian-12/rose-images/rose-src.txt +++ /dev/null @@ -1 +0,0 @@ -<https://www.onlygfx.com/red-rose-png-image-transparent/> diff --git a/user-scripts/debian-12/rosenrot-desktop-icon.png b/user-scripts/debian-12/rosenrot-desktop-icon.png Binary files differnew file mode 100644 index 0000000..163494f --- /dev/null +++ b/user-scripts/debian-12/rosenrot-desktop-icon.png diff --git a/user-scripts/debian-12/rosenrot.desktop b/user-scripts/debian-12/rosenrot.desktop index c970b7a..dc30dc7 100755 --- a/user-scripts/debian-12/rosenrot.desktop +++ b/user-scripts/debian-12/rosenrot.desktop @@ -6,4 +6,4 @@ Terminal=false Exec=/bin/rose %u Name=Rose 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 |