diff --git a/dmenu/config.mk b/dmenu/config.mk index 51c506e..6f55670 100644 --- a/dmenu/config.mk +++ b/dmenu/config.mk @@ -5,20 +5,13 @@ VERSION = 5.4-odweta PREFIX = /usr MANPREFIX = $(PREFIX)/share/man -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib - -# Xinerama, comment if you don't want it -XINERAMALIBS = -lXinerama -XINERAMAFLAGS = -DXINERAMA - -# freetype -FREETYPELIBS = -lfontconfig -lXft -FREETYPEINC = /usr/include/freetype2 +# compiler and linker flags +X11INC = $(shell $(PKG_CONFIG) --cflags x11 xft xrandr xinerama fontconfig freetype2) +X11LIB = $(shell $(PKG_CONFIG) --libs x11 xft xrandr xinerama fontconfig freetype2) # includes and libs -INCS = -I$(X11INC) -I$(FREETYPEINC) -LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) +INCS = $(X11INC) +LIBS = $(X11LIB) # flags CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) diff --git a/dwm/config.mk b/dwm/config.mk index 268eaf7..87b0ec1 100644 --- a/dwm/config.mk +++ b/dwm/config.mk @@ -7,16 +7,13 @@ VERSION = 6.8-odweta PREFIX = /usr MANPREFIX = ${PREFIX}/share/man -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib - -# freetype -FREETYPELIBS = -lfontconfig -lXft -FREETYPEINC = /usr/include/freetype2 +# compiler and linker flags +X11INC = $(shell $(PKG_CONFIG) --cflags x11 xft xrandr xinerama fontconfig freetype2) +X11LIB = $(shell $(PKG_CONFIG) --libs x11 xft xrandr xinerama fontconfig freetype2) # includes and libs -INCS = -I${X11INC} -I${FREETYPEINC} -LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} +INCS = ${X11INC} +LIBS = ${X11LIB} # flags CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} diff --git a/dwmblocks/Makefile b/dwmblocks/Makefile index 6256398..9d36956 100644 --- a/dwmblocks/Makefile +++ b/dwmblocks/Makefile @@ -1,7 +1,16 @@ PREFIX := /usr CC := cc CFLAGS := -pedantic -Wall -Wno-deprecated-declarations -Os -LDFLAGS := -lX11 +LDFLAGS := + +PKG_CONFIG := pkg-config + +# compiler and linker flags +X11INC = $(shell $(PKG_CONFIG) --cflags x11 xft xrandr xinerama fontconfig freetype2) +X11LIB = $(shell $(PKG_CONFIG) --libs x11 xft xrandr xinerama fontconfig freetype2) + +CFLAGS += $(X11INC) +LDFLAGS += $(X11LIB) # FreeBSD (uncomment) #LDFLAGS += -L/usr/local/lib -I/usr/local/include diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..95fae31 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1790450978, + "narHash": "sha256-/eLCD/X9kaWJqPR47+fDozEC87Hjmm3i8gJbYmDAD7g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5e2305d577ca00acbba631b05cb1094d172b29f3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-26.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9844d54 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; + + outputs = { nixpkgs, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in { + devShells.${system}.default = pkgs.mkShell { + packages = with pkgs; [ + gcc + gnumake + pkg-config + libx11 + libxft + libxext + libxrender + libxrandr + libxinerama + libxcrypt + fontconfig + freetype + ]; + }; + }; +} + diff --git a/install.sh b/install.sh index 7ebb597..2d8aad8 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,13 @@ -#1/usr/bin/env bash +#!/usr/bin/env bash + +set -e install_module() { - cd $1 - sudo make install clean - cd - + cd "$1" + make clean + make + sudo make install clean + cd - >/dev/null } install_module dmenu diff --git a/slock/config.mk b/slock/config.mk index eef2825..4e4abd0 100644 --- a/slock/config.mk +++ b/slock/config.mk @@ -7,12 +7,15 @@ VERSION = 1.6-odweta PREFIX = /usr MANPREFIX = ${PREFIX}/share/man -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib +PKG_CONFIG := pkg-config + +# compiler and linker flags +X11INC = $(shell $(PKG_CONFIG) --cflags x11 xft xrandr xinerama fontconfig freetype2) +X11LIB = $(shell $(PKG_CONFIG) --libs x11 xft xrandr xinerama fontconfig freetype2) # includes and libs -INCS = -I. -I/usr/include -I${X11INC} -LIBS = -L/usr/lib -lc -lcrypt -L${X11LIB} -lX11 -lXext -lXrandr +INCS = ${X11INC} +LIBS = -lc -lcrypt ${X11LIB} # flags CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H diff --git a/st/config.mk b/st/config.mk index 3f73c6e..d408e49 100644 --- a/st/config.mk +++ b/st/config.mk @@ -1,29 +1,21 @@ # st version VERSION = 0.9.3-odweta -# Customize below to fit your system - # paths PREFIX = /usr MANPREFIX = $(PREFIX)/share/man -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib - +CC = cc PKG_CONFIG = pkg-config -# includes and libs -INCS = -I$(X11INC) \ - `$(PKG_CONFIG) --cflags fontconfig` \ - `$(PKG_CONFIG) --cflags freetype2` -LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ - `$(PKG_CONFIG) --libs fontconfig` \ - `$(PKG_CONFIG) --libs freetype2` +# compiler and linker flags +X11INC = $(shell $(PKG_CONFIG) --cflags x11 xft xrandr xinerama fontconfig freetype2) +X11LIB = $(shell $(PKG_CONFIG) --libs x11 xft xrandr xinerama fontconfig freetype2) + +INCS = $(X11INC) +LIBS = $(X11LIB) -lm -lrt -lutil -# flags STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS) -STLDFLAGS = $(LIBS) $(LDFLAGS) +STLDFLAGS = $(LDFLAGS) $(LIBS) -# compiler and linker -CC = cc