build: Add wrapper scripts to simplify building

This commit is contained in:
Ole André Vadla Ravnås 2024-04-06 12:03:01 +02:00
parent 9b68d34e03
commit b9acd6a2f5
5 changed files with 85 additions and 0 deletions

6
BSDmakefile Normal file
View file

@ -0,0 +1,6 @@
all: .DEFAULT
.DEFAULT:
@gmake ${.MAKEFLAGS} ${.TARGETS}
.PHONY: all

16
Makefile Normal file
View file

@ -0,0 +1,16 @@
PYTHON ?= $(shell which python3 >/dev/null && echo python3 || echo python)
all $(MAKECMDGOALS):
@$(PYTHON) \
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" \
"$(shell pwd)" \
./build \
$(MAKECMDGOALS)
git-submodules:
@if [ ! -f releng/meson/meson.py ]; then \
git submodule update --init --recursive --depth 1; \
fi
-include git-submodules
.PHONY: all $(MAKECMDGOALS)

18
configure vendored Executable file
View file

@ -0,0 +1,18 @@
#!/bin/sh
[ -z "$PYTHON" ] && PYTHON=$(which python3 >/dev/null && echo python3 || echo python)
cd $(dirname $0)
srcroot=$(pwd)
if [ ! -f releng/meson/meson.py ]; then
git submodule update --init --recursive --depth 1 || exit $?
fi
cd - >/dev/null
exec "$PYTHON" \
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_configure import main; main()" \
"$srcroot" \
"$@"

22
configure.bat Normal file
View file

@ -0,0 +1,22 @@
@setlocal
@echo off
rem:: Based on: https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
goto :_start_
:set_real_dp0
set dp0=%~dp0
set "dp0=%dp0:~0,-1%"
goto :eof
:_start_
call :set_real_dp0
if not exist "%dp0%\releng\meson\meson.py" (
pushd "%dp0%" & git submodule update --init --recursive --depth 1 & popd
if %errorlevel% neq 0 exit /b %errorlevel%
)
endlocal & goto #_undefined_# 2>nul || title %COMSPEC% & python ^
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_configure import main; main()" ^
"%dp0%" ^
%*

23
make.bat Normal file
View file

@ -0,0 +1,23 @@
@setlocal
@echo off
rem:: Based on: https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
goto :_start_
:set_real_dp0
set dp0=%~dp0
set "dp0=%dp0:~0,-1%"
goto :eof
:_start_
call :set_real_dp0
if not exist "%dp0%\releng\meson\meson.py" (
pushd "%dp0%" & git submodule update --init --recursive --depth 1 & popd
if %errorlevel% neq 0 exit /b %errorlevel%
)
endlocal & goto #_undefined_# 2>nul || title %COMSPEC% & python ^
-c "import sys; sys.path.insert(0, sys.argv[1]); from releng.meson_make import main; main()" ^
"%dp0%" ^
.\build ^
%*