#!/bin/sh # fallback to no config if [ -z "$HOME/.lenv" ] then echo "_env=dev" > $HOME/.lenv echo "_dir=$HOME/src/luakit-dev" >> $HOME/.lenv fi # load config . $HOME/.lenv _action="$1" shift # validation if [ -z "$_env" ] || [ -z "$_dir" ] then echo "Incomplete environment" exit 1 fi if [ -z "$_action" ] then echo "No action provided" exit 1 fi # now we can start... echo "luakit-$_env: perform $_action $@ (in $_dir)" | xargs # change into environment mkdir -p "$_dir" _oldpwd="$PWD" cd "$_dir" # perform actions if [ "$_action" == "help" ] || [ "$_action" == "h" ] then echo "usage: l action [args]" echo " actions:" echo " make - build luakit" echo " remake - make with -j1 (for debugging)" echo " test [test] - run luakit test suite [specific test]" echo " debug [luakit args] - start in gdb, stop in main" echo " pr [numbers] - show [pull] PR from luakit/luakit repo" echo " update - update/rebase repository" echo " reset - recreate environment ($_dir)" echo " diff file env - diff file with other environment" echo " update-port - update openbsd port from last commit" echo echo " other commands:" echo " ledit - edit this script" echo " ldev - switch to dev environment" echo " ltest - switch to test environment" echo " ltemp - switch to temp environment" echo " lsdk - switch to sdk environment" echo fi if [ "$_action" == "test" ] then export G_ENABLE_DIAGNOSTIC=1; luajit tests/run_test.lua $@; fi if [ "$_action" == "make" ] then set -x gmake clean gmake options gmake -j 8 luakit gmake tests/util.so fi if [ "$_action" == "remake" ] then gmake -j1 luakit fi if [ "$_action" == "debug" ] then egdb -ex "break luakit.c:main" -ex "run $@" ./luakit fi if [ "$_action" == "reset" ] then if [ "$_env" == "sdk" ] then cd /tmp rm -rf "$_dir" git clone git@github.com:c0dev0id/luakit "$_dir" cd "$_dir" set -xe git remote add upstream git@github.com:luakit/luakit git fetch upstream git checkout develop git rebase upstream/develop git switch -c patch set +xe else cd /tmp rm -rf "$_dir" git clone git@github.com:luakit/luakit "$_dir" cd "$_dir" fi fi if [ "$_action" == "update" ] then set -xe if [ "$_env" == "sdk" ] then git fetch --all git checkout develop git rebase upstream/develop --autostash git checkout - else git checkout develop git fetch --all git rebase origin/develop fi set +xe fi if [ "$_action" == "diff" ] then set -x f="$(readlink -f $_oldpwd/$1)" f="${f#$_dir}" vimdiff "$_dir/$f" "${_dir%$_env}$2/$f" fi if [ "$_action" == "pr" ] then if [ -n "$1" ] then for pr in $@ do gh pr checkout $pr done else gh pr --repo luakit/luakit list $@ | cat fi fi if [ "$_action" == "update-port" ] then cd /usr/ports/mystuff/www/luakit commit="$(basename $(gh browse --repo luakit/luakit -c -n))" sed -i "s/^COMMIT =.*/COMMIT = $commit/" Makefile make clean=all portbump make makesum make reinstall fi