mirror of
https://github.com/chocolate-doom/chocpkg.git
synced 2024-11-10 07:11:39 +00:00
Add variants support.
It's nice to be able to build from source control HEAD, and especially for packages under than Chocolate Doom itself. As a start, define "latest" variants for all the SDL2 packages.
This commit is contained in:
parent
72f8e10c44
commit
ca536950f8
7 changed files with 55 additions and 4 deletions
|
@ -85,6 +85,14 @@ configure_for_package() {
|
|||
PACKAGE_TYPE=target
|
||||
fi
|
||||
|
||||
# Allow /suffix to specify a variant to build.
|
||||
if [[ "$package" =~ .*/.* ]]; then
|
||||
PACKAGE_VARIANT=${package/#*\//}
|
||||
package=${package/%\/*/}
|
||||
else
|
||||
PACKAGE_VARIANT=stable
|
||||
fi
|
||||
|
||||
# Defaults before loading package file.
|
||||
PACKAGE_DESCRIPTION="Package $package"
|
||||
DEPENDENCIES=""
|
||||
|
|
|
@ -5,6 +5,13 @@ install_module() {
|
|||
${module_name}::init "$@"
|
||||
}
|
||||
|
||||
variant() {
|
||||
local for_variant=$1; shift
|
||||
if [ "$PACKAGE_VARIANT" = "$for_variant" ]; then
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
package_group() {
|
||||
install_module package_group "$@"
|
||||
}
|
||||
|
|
|
@ -75,6 +75,32 @@ Build modules specify how to build the package after it is fetched:
|
|||
build_autotools --disable-broken-feature
|
||||
```
|
||||
|
||||
### Variants
|
||||
|
||||
Variants allow building of different versions of the same package. An
|
||||
example is "latest stable release" vs. "latest version from source
|
||||
repository". The default variant is called `stable`. A variant can be
|
||||
specified on the command line with a suffix, for example, to build the
|
||||
variant `latest` of package `neato-lib`:
|
||||
|
||||
```shell
|
||||
chocpkg install neato-lib/latest
|
||||
```
|
||||
|
||||
In package files the `variant` function is used for conditional code
|
||||
that is only executed for a particular variant. Usually this is used
|
||||
to select a fetch module. For example:
|
||||
|
||||
```shell
|
||||
variant stable fetch_download http://example.com/neato-lib-0.0.1.tar.gz
|
||||
variant latest fetch_git git://example.com/neato-lib.git
|
||||
variant frob-branch fetch_git git://example.com/neato-lib.git frob-branch
|
||||
```
|
||||
|
||||
By convention, the `stable` variant is "the most recent stable release
|
||||
of the package" while the `latest` variant is "the latest version in
|
||||
the source control repository".
|
||||
|
||||
### Other modules and functions
|
||||
|
||||
* `dependencies`: Arguments provided to the function are the names
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
description "Simple DirectMedia Layer"
|
||||
check_pkgconfig sdl2
|
||||
fetch_download http://www.libsdl.org/release/SDL2-2.0.4.tar.gz
|
||||
|
||||
variant stable fetch_download http://www.libsdl.org/release/SDL2-2.0.4.tar.gz
|
||||
variant latest fetch_hg https://hg.libsdl.org/SDL/
|
||||
|
||||
config_options=
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
description "SDL imaging library"
|
||||
dependencies SDL2
|
||||
check_pkgconfig SDL2_image
|
||||
fetch_download https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
|
||||
|
||||
variant stable fetch_download \
|
||||
https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.tar.gz
|
||||
variant latest fetch_hg https://hg.libsdl.org/SDL_image/
|
||||
|
||||
# SDL2_image supports lots of different file formats but we only care
|
||||
# about .png files. So just build a really thin library without support
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
description "SDL audio mixing and music library"
|
||||
dependencies SDL2
|
||||
check_pkgconfig SDL2_mixer
|
||||
fetch_download http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
|
||||
|
||||
variant stable fetch_download \
|
||||
http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.tar.gz
|
||||
variant latest fetch_hg https://hg.libsdl.org/SDL_mixer
|
||||
|
||||
# Disable dependencies on external libraries for sound file formats:
|
||||
config_options="
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
description "SDL networking library"
|
||||
dependencies SDL2
|
||||
check_pkgconfig SDL2_net
|
||||
fetch_download http://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz
|
||||
variant stable fetch_download \
|
||||
http://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz
|
||||
variant latest fetch_hg https://hg.libsdl.org/SDL_net
|
||||
build_autotools
|
||||
|
|
Loading…
Reference in a new issue