diff options
author | Rasmus Thomsen <oss@cogitri.dev> | 2019-08-29 19:41:42 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2019-10-01 17:12:19 +0100 |
commit | 05eee44039fb1f099f78abaab4eec9bd014be8ee (patch) | |
tree | 90af0705dc9a9a02f719d09d5eac5de1b7914531 /newapkbuild.in | |
parent | f9da71cc68f542593c51407376b34a50b6f6cd6b (diff) | |
download | abuild-05eee44039fb1f099f78abaab4eec9bd014be8ee.tar.gz abuild-05eee44039fb1f099f78abaab4eec9bd014be8ee.tar.bz2 abuild-05eee44039fb1f099f78abaab4eec9bd014be8ee.tar.xz abuild-05eee44039fb1f099f78abaab4eec9bd014be8ee.zip |
newapkbuild: add rust support
Diffstat (limited to 'newapkbuild.in')
-rw-r--r-- | newapkbuild.in | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/newapkbuild.in b/newapkbuild.in index f0dc911..76fd7ab 100644 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -104,6 +104,12 @@ build_python() { __EOF__ } +build_rust() { + cat >>APKBUILD<<__EOF__ + cargo build --release +__EOF__ +} + build_empty() { cat >>APKBUILD<<__EOF__ # Replace with proper build command(s) @@ -137,6 +143,12 @@ check_meson() { __EOF__ } +check_rust() { + cat >>APKBUILD<<__EOF__ + cargo test --release +__EOF__ +} + # Package sections package_make() { cat >>APKBUILD<<__EOF__ @@ -174,6 +186,13 @@ package_empty() { __EOF__ } +package_rust() { + cat >>APKBUILD<<__EOF__ + cargo install --path . --root="\$pkgdir/usr" + rm "\$pkgdir"/usr/.crates.toml +__EOF__ +} + # Create new aport from templates newaport() { local newname="${1##*/}" @@ -216,6 +235,7 @@ newaport() { python) makedepends="py3-setuptools";; cmake) makedepends="cmake";; meson) makedepends="meson";; + rust) makedepends="cargo";; *) makedepends="\$depends_dev";; esac @@ -288,6 +308,8 @@ __EOF__ buildtype="make" elif [ -r "$sdir"/setup.py ]; then buildtype="python" + elif [ -r "$sdir"/Cargo.toml ]; then + buildtype="rust" fi fi @@ -309,6 +331,8 @@ __EOF__ build_perl;; python) build_python;; + rust) + build_rust;; *) build_empty;; esac @@ -328,6 +352,8 @@ __EOF__ check_make;; python) check_python;; + rust) + check_rust;; *) check_empty;; esac @@ -353,6 +379,8 @@ __EOF__ package_perl;; python) package_python;; + rust) + package_rust;; *) package_empty;; esac @@ -379,7 +407,7 @@ usage() { cat >&2 <<-__EOF__ $program $program_version - generate a new APKBUILD Usage: $program [-n PKGNAME] [-d PKGDESC] [-l LICENSE] [-u URL] - [-a | -C | -m | -p | -y] [-s] [-c] [-f] [-h] + [-a | -C | -m | -p | -y | -r] [-s] [-c] [-f] [-h] PKGNAME[-PKGVER] | SRCURL Options: -n Set package name to PKGNAME (only use with SRCURL) @@ -392,6 +420,7 @@ usage() { -m Create meson package (Assume meson.build is there) -p Create perl package (Assume Makefile.PL is there) -y Create python package (Assume setup.py is there) + -r Crate rust package (Assume Cargo.toml is there) -s Use sourceforge source URL -c Copy a sample init.d, conf.d, and install script -f Force even if directory already exists @@ -427,7 +456,7 @@ check_arguments() { fi } -while getopts "acCmd:fhl:n:pyu:s" opt; do +while getopts "acCmd:fhl:n:pyu:sr" opt; do case $opt in 'a') set_buildtype "autotools";; 'c') cpinitd=1;; @@ -440,6 +469,7 @@ while getopts "acCmd:fhl:n:pyu:s" opt; do 'n') pkgname="$OPTARG";; 'p') set_buildtype "perl";; 'y') set_buildtype "python";; + 'r') set_buildtype "rust";; 'u') url="$OPTARG";; 's') sourceforge=1;; esac |