feat: allow applets to be shared modules
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# Makefile for the Printers shared desktop applet
|
||||
# Copyright (c) 2026 Daniel Hammer
|
||||
|
||||
MAKEFLAGS += -rR
|
||||
.SUFFIXES:
|
||||
|
||||
TOOLCHAIN_PREFIX := $(shell cd ../../.. && pwd)/toolchain/local/bin/x86_64-elf-
|
||||
ifneq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
|
||||
CXX := $(TOOLCHAIN_PREFIX)g++
|
||||
LD := $(TOOLCHAIN_PREFIX)ld
|
||||
else
|
||||
CXX := g++
|
||||
LD := ld
|
||||
endif
|
||||
|
||||
OUTDIR := ../../bin/os
|
||||
OBJDIR := obj
|
||||
TARGET := $(OUTDIR)/libprintersapplet.lib
|
||||
|
||||
CXXFLAGS := \
|
||||
-std=gnu++20 \
|
||||
-g -O2 -pipe \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-nostdinc \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-fno-stack-check \
|
||||
-fPIC \
|
||||
-fno-rtti \
|
||||
-fno-exceptions \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-m64 \
|
||||
-march=x86-64 \
|
||||
-mno-red-zone \
|
||||
-mcmodel=small \
|
||||
-MMD -MP \
|
||||
-I ../../include \
|
||||
-isystem ../../include/libc \
|
||||
-isystem ../../../kernel/freestnd-c-hdrs/x86_64/include \
|
||||
-isystem ../../../kernel/freestnd-cxx-hdrs/x86_64/include
|
||||
|
||||
LDFLAGS := \
|
||||
-shared \
|
||||
--build-id=none \
|
||||
--hash-style=sysv \
|
||||
-m elf_x86_64 \
|
||||
-z max-page-size=0x1000
|
||||
|
||||
SRCS := src/libprintersapplet.cpp
|
||||
OBJS := $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o))
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) Makefile
|
||||
mkdir -p $(OUTDIR)
|
||||
$(LD) $(LDFLAGS) $(OBJS) -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp Makefile
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
-include $(OBJS:.o=.d)
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJDIR) $(TARGET)
|
||||
@@ -0,0 +1,6 @@
|
||||
obj/src/libprintersapplet.o: src/libprintersapplet.cpp \
|
||||
../../include/gui/desktop_applet.hpp ../../include/montauk/syscall.h \
|
||||
../../include/Api/Syscall.hpp
|
||||
../../include/gui/desktop_applet.hpp:
|
||||
../../include/montauk/syscall.h:
|
||||
../../include/Api/Syscall.hpp:
|
||||
Binary file not shown.
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* libprintersapplet.cpp
|
||||
* Shared desktop applet that launches the Printers configuration tool
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#include <gui/desktop_applet.hpp>
|
||||
#include <montauk/syscall.h>
|
||||
|
||||
using gui::desktop_applet::Descriptor;
|
||||
using gui::desktop_applet::Host;
|
||||
|
||||
static constexpr Descriptor kAppletDescriptor = {
|
||||
gui::desktop_applet::ABI_VERSION,
|
||||
gui::desktop_applet::CAP_SYSTEM_CONFIGURATION,
|
||||
"printers",
|
||||
"Printers",
|
||||
"0:/icons/printer.svg",
|
||||
};
|
||||
|
||||
extern "C" const Descriptor* desktop_applet_query_v1() {
|
||||
return &kAppletDescriptor;
|
||||
}
|
||||
|
||||
extern "C" bool desktop_applet_open_v1(const Host* host) {
|
||||
(void)host;
|
||||
return montauk::spawn("0:/apps/printers/printers.elf") >= 0;
|
||||
}
|
||||
Reference in New Issue
Block a user