Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello World using Relang #440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Relang/BSDmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
all: .DEFAULT

.DEFAULT:
@gmake ${.MAKEFLAGS} ${.TARGETS}

.PHONY: all
16 changes: 16 additions & 0 deletions Relang/Makefile
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions Relang/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [Relang by Frida](https://github.com/frida/releng)

## How to run

- Clone relang with below command

```bash
git submodule add https://github.com/frida/releng.git
```

- Build and run

```bash
make
$ make
$ ./build/hello
Hello World from Vala!

```
18 changes: 18 additions & 0 deletions Relang/configure
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions Relang/configure.bat
Original file line number Diff line number Diff line change
@@ -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%" ^
%*
4 changes: 4 additions & 0 deletions Relang/hello.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
int main (string[] args) {
print ("Hello World from Vala!\n");
return 0;
}
23 changes: 23 additions & 0 deletions Relang/make.bat
Original file line number Diff line number Diff line change
@@ -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 ^
%*
3 changes: 3 additions & 0 deletions Relang/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project('my-project', 'vala', version: '1.0.0')
executable('hello', 'hello.vala', dependencies: dependency('glib-2.0'))