aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorJan Beich <[email protected]>2023-05-02 13:38:36 +0000
committerGitHub <[email protected]>2023-05-02 14:38:36 +0100
commit609c7ab6b5af90de947b55999d6a8bee7d048382 (patch)
treee9d87edeb70e85fb0c56913b4272d89c94f6eb1d /Makefile
parentc949173bc9c9f9e8276cba098cb82ed51ad4965b (diff)
downloadHyprland-609c7ab6b5af90de947b55999d6a8bee7d048382.tar.gz
Hyprland-609c7ab6b5af90de947b55999d6a8bee7d048382.zip
Unbreak CMake build on FreeBSD (#2209)
* cmake: unbreak on non-GNU after 474ada9267cc CMake Error at CMakeLists.txt:121 (target_link_libraries): The keyword signature for target_link_libraries has already been used with the target "Hyprland". All uses of target_link_libraries with a target must be either all-keyword or all-plain. The uses of the keyword signature are here: * CMakeLists.txt:107 (target_link_libraries) Fixes https://github.com/hyprwm/Hyprland/issues/1780 * cmake: always link with dependencies via imported targets On BSD systems base compiler by default only looks for headers and libraries from base system. For dependencies from packages extra flags are necessary. ld: error: unable to find library -lxcb ld: error: unable to find library -lpixman-1 ld: error: unable to find library -lOpenGL ld: error: unable to find library -lGLESv2 * make: use same make in recursive calls On BSDs `make` is BSD make while `gmake` is GNU make * make: work around GNU vs. BSD sed -i incompatibility https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254091 * make: replace GNU make extension with POSIX sh `$(shell ...)` in GNU make is similar to `${:!..!}` in BSD make * make: fall back when nproc isn't available Only FreeBSD added nproc for compatibility with Linux. * make: unbreak hyprctl on Clang-based systems /bin/sh: g++: not found error: invalid value 'c++23' in '-std=c++23' * make: create lib/ before copying libwlroots.so there $ make install PREFIX=/tmp/test [...] cp: directory /tmp/test/lib does not exist * make: pass cp(1) flags before arguments cp: -f is not a directory * make: replace install -Dt with mkdir install: illegal option -- t * make: replace cp --parents with cpio -dump cp: illegal option -- - * make: limit pkg-config workaround to Linux when run as root /usr/share/pkgconfig doesn't exist on BSDs or may not be writable.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile67
1 files changed, 34 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 1af92f92..25538384 100644
--- a/Makefile
+++ b/Makefile
@@ -2,19 +2,19 @@ PREFIX = /usr/local
legacyrenderer:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
- cmake --build ./build --config Release --target all -j$(shell nproc)
+ cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
legacyrendererdebug:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
- cmake --build ./build --config Release --target all -j$(shell nproc)
+ cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
release:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja
- cmake --build ./build --config Release --target all -j$(shell nproc)
+ cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
debug:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -S . -B ./build -G Ninja
- cmake --build ./build --config Debug --target all -j$(shell nproc)
+ cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
clear:
rm -rf build
@@ -23,47 +23,48 @@ clear:
rm -rf ./subprojects/wlroots/build
all:
- make clear
- make fixwlr
- cd ./subprojects/wlroots && meson setup build/ --buildtype=release && ninja -C build/ && cp ./build/libwlroots.so.12032 ${PREFIX}/lib/ || echo "Could not install libwlroots to ${PREFIX}/lib/libwlroots.so.12032"
- cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B./build -G Ninja && cmake --build ./build --config Release --target all -j$(shell nproc)
- make release
- make -C hyprctl all
+ $(MAKE) clear
+ $(MAKE) fixwlr
+ cd ./subprojects/wlroots && meson setup build/ --buildtype=release && ninja -C build/ && mkdir -p ${PREFIX}/lib/ && cp ./build/libwlroots.so.12032 ${PREFIX}/lib/ || echo "Could not install libwlroots to ${PREFIX}/lib/libwlroots.so.12032"
+ cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
+ $(MAKE) release
+ $(MAKE) -C hyprctl all
install:
- make clear
- make fixwlr
- cd ./subprojects/wlroots && meson setup build/ --buildtype=release && ninja -C build/ && cp ./build/libwlroots.so.12032 ${PREFIX}/lib/ || echo "Could not install libwlroots to ${PREFIX}/lib/libwlroots.so.12032"
- cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B./build -G Ninja && cmake --build ./build --config Release --target all -j$(shell nproc) && cd ../..
- make release
- make -C hyprctl all
+ $(MAKE) clear
+ $(MAKE) fixwlr
+ cd ./subprojects/wlroots && meson setup build/ --buildtype=release && ninja -C build/ && mkdir -p ${PREFIX}/lib/ && cp ./build/libwlroots.so.12032 ${PREFIX}/lib/ || echo "Could not install libwlroots to ${PREFIX}/lib/libwlroots.so.12032"
+ cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` && cd ../..
+ $(MAKE) release
+ $(MAKE) -C hyprctl all
mkdir -p ${PREFIX}/share/wayland-sessions
mkdir -p ${PREFIX}/bin
- cp ./build/Hyprland ${PREFIX}/bin -f
- cp ./hyprctl/hyprctl ${PREFIX}/bin -f
+ cp -f ./build/Hyprland ${PREFIX}/bin
+ cp -f ./hyprctl/hyprctl ${PREFIX}/bin
if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi
mkdir -p ${PREFIX}/share/hyprland
cp ./assets/wall_2K.png ${PREFIX}/share/hyprland
cp ./assets/wall_4K.png ${PREFIX}/share/hyprland
cp ./assets/wall_8K.png ${PREFIX}/share/hyprland
- install -Dm644 -t ${PREFIX}/share/man/man1 ./docs/*.1
+ mkdir -p ${PREFIX}/share/man/man1
+ install -m644 ./docs/*.1 ${PREFIX}/share/man/man1
mkdir -p ${PREFIX}/include/hyprland
mkdir -p ${PREFIX}/include/hyprland/protocols
mkdir -p ${PREFIX}/include/hyprland/wlroots
mkdir -p ${PREFIX}/share/pkgconfig
- find src -name '*.h*' -exec cp --parents '{}' ${PREFIX}/include/hyprland ';'
- cd subprojects/wlroots/include && find . -name '*.h*' -exec cp --parents '{}' ${PREFIX}/include/hyprland/wlroots ';' && cd ../../..
+ find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
+ cd subprojects/wlroots/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../..
cp ./protocols/*-protocol.h ${PREFIX}/include/hyprland/protocols
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
- cp ./build/hyprland.pc /usr/share/pkgconfig
+ if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi
cleaninstall:
- echo -en "make cleaninstall has been DEPRECATED, you should avoid using it in the future.\nRunning make install instead...\n"
- make install
+ echo -en "$(MAKE) cleaninstall has been DEPRECATED, you should avoid using it in the future.\nRunning $(MAKE) install instead...\n"
+ $(MAKE) install
uninstall:
rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop
@@ -75,24 +76,24 @@ uninstall:
rm -f ${PREFIX}/share/man/man1/hyprctl.1
fixwlr:
- sed -i -E 's/(soversion = 12)([^032]|$$)/soversion = 12032/g' subprojects/wlroots/meson.build
+ sed -E -i -e 's/(soversion = 12)([^032]|$$)/soversion = 12032/g' subprojects/wlroots/meson.build
rm -rf ./subprojects/wlroots/build
config:
- make fixwlr
+ $(MAKE) fixwlr
meson setup subprojects/wlroots/build subprojects/wlroots --prefix=${PREFIX} --buildtype=release -Dwerror=false -Dexamples=false
ninja -C subprojects/wlroots/build/
ninja -C subprojects/wlroots/build/ install
- cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja && cmake --build ./build --config Release --target all -j$(shell nproc)
+ cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
pluginenv:
- cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja && cmake --build ./build --config Release --target all -j$(shell nproc)
+ cd subprojects/udis86 && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -S . -B ./build -G Ninja && cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
- make fixwlr
+ $(MAKE) fixwlr
meson setup subprojects/wlroots/build subprojects/wlroots --prefix=${PREFIX} --buildtype=release -Dwerror=false -Dexamples=false
ninja -C subprojects/wlroots/build/
@@ -104,14 +105,14 @@ pluginenv:
mkdir -p ${PREFIX}/include/hyprland/wlroots
mkdir -p ${PREFIX}/share/pkgconfig
- find src -name '*.h*' -exec cp --parents '{}' ${PREFIX}/include/hyprland ';'
- cd subprojects/wlroots/include && find . -name '*.h*' -exec cp --parents '{}' ${PREFIX}/include/hyprland/wlroots ';' && cd ../../..
+ find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
+ cd subprojects/wlroots/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots && cd ../../..
cp ./protocols/*-protocol.h ${PREFIX}/include/hyprland/protocols
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
- cp ./build/hyprland.pc /usr/share/pkgconfig
+ if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi
configdebug:
- make fixwlr
+ $(MAKE) fixwlr
meson setup subprojects/wlroots/build subprojects/wlroots --prefix=${PREFIX} --buildtype=debug -Dwerror=false -Dexamples=false -Db_sanitize=address
ninja -C subprojects/wlroots/build/