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

docs: add example with auto detection of SDL2 version #516

Merged
merged 5 commits into from
Jul 26, 2023

Conversation

larpon
Copy link
Contributor

@larpon larpon commented Jul 26, 2023

@spytheman
Copy link
Member

post_setup.vsh

import os

os.chdir(os.dir(os.executable()))!

res := os.execute('sdl2-config --version')
if res.exit_code != 0 { println('sdl2-config is missing') exit(1) }
system_version := res.output.trim_space()
println('Your version is $system_version')

remotes := os.execute('git branch -r --list')
if remotes.exit_code != 0 { println('git is missing') exit(1) }
supported_versions := remotes.output.split_into_lines().map(it.trim_space()).filter(it.starts_with('origin/2')).map(it.all_after('origin/'))
println('The SDL module officially supports these versions of SDL:\n   $supported_versions')

if system_version in supported_versions {
	println('Setting up the repository to branch $system_version that exactly matches your system SDL version')
	os.system('git checkout $system_version')
	exit(0)
}

base_version := '${system_version.all_before_last('.')}.0'
println('Setting up the repository to branch $base_version, that best matches the system SDL version: $system_version ...')
os.system('git checkout $base_version')

@spytheman
Copy link
Member

spytheman commented Jul 26, 2023

I thought that if we already have portable V, then why not use it and make it a little bit more maintainable :-) .

Usage: v ~/.vmodules/sdl/post_setup.vsh .

…users

Add a script to ease the post installation setup of SDL for end users.
@larpon
Copy link
Contributor Author

larpon commented Jul 26, 2023

Super nice addition 💯

@larpon larpon merged commit c8ef6a3 into vlang:master Jul 26, 2023
4 checks passed
@larpon larpon deleted the 208/docs/add-auto-sdl2-version-example branch July 26, 2023 21:47
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit to larpon/sdl that referenced this pull request Jul 26, 2023
…lang#516)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#517)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#518)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#519)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#521)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#522)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#523)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#525)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#524)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#527)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#520)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
larpon added a commit that referenced this pull request Jul 26, 2023
…516) (#526)

* docs: add example with auto detection of SDL2 version

* add setup.vsh, to make matching the installed SDL version easier for users

Add a script to ease the post installation setup of SDL for end users.

* Update README.md

* insert 2.0.8 master at the start of supported_versions

* Update setup.vsh

---------

Co-authored-by: Delyan Angelov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants