Commit 2565eb3c authored by Gavin John's avatar Gavin John
Browse files

system76-wallpapers: init at 0-unstable-2024-04-26

parent a3f30129
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
BACKGROUNDS=$(wildcard backgrounds/*)
SCALED=$(sort $(patsubst backgrounds/%, scaled/%, $(BACKGROUNDS)))

prefix ?= /usr
datarootdir = $(prefix)/share
datadir = $(datarootdir)

.PHONY: all clean install uninstall

all: $(SCALED) scaled/info.xml

clean:
	rm -rf build scaled

install: all
	for file in $(SCALED); do \
		install -D -m 0644 "$$file" "$(DESTDIR)$(datadir)/backgrounds/system76/$$(basename "$$file")"; \
	done
	install -D -m 0644 "scaled/info.xml" "$(DESTDIR)$(datadir)/gnome-background-properties/system76-wallpapers.xml"

uninstall:
	for file in $(SCALED); do \
		rm -f "$(DESTDIR)$(datadir)/backgrounds/system76/$$(basename "$$file")"; \
	done
	rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(datadir)/backgrounds/system76/"
	rm -f "$(DESTDIR)$(datadir)/gnome-background-properties/system76-wallpapers.xml"
	rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(datadir)/gnome-background-properties/"

scaled/%: backgrounds/%
	@mkdir -p build scaled
	magick "$<" -resize "3840x2160^" "build/$*"
	mv "build/$*" "$@"

scaled/info.xml: $(SCALED)
	@mkdir -p build scaled
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "build/info.xml"
	echo "<!DOCTYPE wallpapers SYSTEM \"gnome-wp-list.dtd\">" >> "build/info.xml"
	echo "<wallpapers>" >> "build/info.xml"
	for file in $(SCALED); do \
		filename="$$(basename "$$file")"; \
		name="$${filename%.*}"; \
		echo "    <wallpaper>" >> "build/info.xml"; \
		echo "        <name>$$name</name>" >> "build/info.xml"; \
		echo "        <filename>/usr/share/backgrounds/system76/$$(basename "$$file")</filename>" >> "build/info.xml"; \
		echo "        <options>zoom</options>" >> "build/info.xml"; \
		echo "        <pcolor>#000000</pcolor>" >> "build/info.xml"; \
		echo "        <scolor>#000000</scolor>" >> "build/info.xml"; \
		echo "        <shade_type>solid</shade_type>" >> "build/info.xml"; \
		echo "    </wallpaper>" >> "build/info.xml"; \
	done
	echo "</wallpapers>" >> "build/info.xml"
	mv "build/info.xml" "$@"
+42 −0
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  fetchpatch,
  imagemagick,
  nix-update-script,
}:

stdenvNoCC.mkDerivation {
  pname = "system76-wallpapers";
  version = "0-unstable-2024-04-26";

  src = fetchFromGitHub {
    owner = "pop-os";
    repo = "system76-wallpapers";
    rev = "ff1e25c79d10c699dfb695374d5ae7b3f8031b2b";
    forceFetchGit = true;
    fetchLFS = true;
    hash = "sha256-5rddxbi/hRPy93DqswG54HzWK33Y5TteGB8SKjLXJZk=";
  };

  prePatch = ''
    cp ${./Makefile} Makefile
  '';

  nativeBuildInputs = [ imagemagick ];

  makeFlags = [ "prefix=$(out)" ];

  passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };

  meta = {
    description = "Wallpapers for System76 products";
    homepage = "https://system76.com/";
    license = with lib.licenses; [
      unfree # No license specified
    ];
    maintainers = with lib.maintainers; [ pandapip1 ];
    platforms = lib.platforms.all;
  };
}