newapkbuild: add rust support
This commit is contained in:
parent
f9da71cc68
commit
05eee44039
@ -104,6 +104,12 @@ build_python() {
|
|||||||
__EOF__
|
__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_rust() {
|
||||||
|
cat >>APKBUILD<<__EOF__
|
||||||
|
cargo build --release
|
||||||
|
__EOF__
|
||||||
|
}
|
||||||
|
|
||||||
build_empty() {
|
build_empty() {
|
||||||
cat >>APKBUILD<<__EOF__
|
cat >>APKBUILD<<__EOF__
|
||||||
# Replace with proper build command(s)
|
# Replace with proper build command(s)
|
||||||
@ -137,6 +143,12 @@ check_meson() {
|
|||||||
__EOF__
|
__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_rust() {
|
||||||
|
cat >>APKBUILD<<__EOF__
|
||||||
|
cargo test --release
|
||||||
|
__EOF__
|
||||||
|
}
|
||||||
|
|
||||||
# Package sections
|
# Package sections
|
||||||
package_make() {
|
package_make() {
|
||||||
cat >>APKBUILD<<__EOF__
|
cat >>APKBUILD<<__EOF__
|
||||||
@ -174,6 +186,13 @@ package_empty() {
|
|||||||
__EOF__
|
__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package_rust() {
|
||||||
|
cat >>APKBUILD<<__EOF__
|
||||||
|
cargo install --path . --root="\$pkgdir/usr"
|
||||||
|
rm "\$pkgdir"/usr/.crates.toml
|
||||||
|
__EOF__
|
||||||
|
}
|
||||||
|
|
||||||
# Create new aport from templates
|
# Create new aport from templates
|
||||||
newaport() {
|
newaport() {
|
||||||
local newname="${1##*/}"
|
local newname="${1##*/}"
|
||||||
@ -216,6 +235,7 @@ newaport() {
|
|||||||
python) makedepends="py3-setuptools";;
|
python) makedepends="py3-setuptools";;
|
||||||
cmake) makedepends="cmake";;
|
cmake) makedepends="cmake";;
|
||||||
meson) makedepends="meson";;
|
meson) makedepends="meson";;
|
||||||
|
rust) makedepends="cargo";;
|
||||||
*) makedepends="\$depends_dev";;
|
*) makedepends="\$depends_dev";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -288,6 +308,8 @@ __EOF__
|
|||||||
buildtype="make"
|
buildtype="make"
|
||||||
elif [ -r "$sdir"/setup.py ]; then
|
elif [ -r "$sdir"/setup.py ]; then
|
||||||
buildtype="python"
|
buildtype="python"
|
||||||
|
elif [ -r "$sdir"/Cargo.toml ]; then
|
||||||
|
buildtype="rust"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -309,6 +331,8 @@ __EOF__
|
|||||||
build_perl;;
|
build_perl;;
|
||||||
python)
|
python)
|
||||||
build_python;;
|
build_python;;
|
||||||
|
rust)
|
||||||
|
build_rust;;
|
||||||
*)
|
*)
|
||||||
build_empty;;
|
build_empty;;
|
||||||
esac
|
esac
|
||||||
@ -328,6 +352,8 @@ __EOF__
|
|||||||
check_make;;
|
check_make;;
|
||||||
python)
|
python)
|
||||||
check_python;;
|
check_python;;
|
||||||
|
rust)
|
||||||
|
check_rust;;
|
||||||
*)
|
*)
|
||||||
check_empty;;
|
check_empty;;
|
||||||
esac
|
esac
|
||||||
@ -353,6 +379,8 @@ __EOF__
|
|||||||
package_perl;;
|
package_perl;;
|
||||||
python)
|
python)
|
||||||
package_python;;
|
package_python;;
|
||||||
|
rust)
|
||||||
|
package_rust;;
|
||||||
*)
|
*)
|
||||||
package_empty;;
|
package_empty;;
|
||||||
esac
|
esac
|
||||||
@ -379,7 +407,7 @@ usage() {
|
|||||||
cat >&2 <<-__EOF__
|
cat >&2 <<-__EOF__
|
||||||
$program $program_version - generate a new APKBUILD
|
$program $program_version - generate a new APKBUILD
|
||||||
Usage: $program [-n PKGNAME] [-d PKGDESC] [-l LICENSE] [-u URL]
|
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
|
PKGNAME[-PKGVER] | SRCURL
|
||||||
Options:
|
Options:
|
||||||
-n Set package name to PKGNAME (only use with SRCURL)
|
-n Set package name to PKGNAME (only use with SRCURL)
|
||||||
@ -392,6 +420,7 @@ usage() {
|
|||||||
-m Create meson package (Assume meson.build is there)
|
-m Create meson package (Assume meson.build is there)
|
||||||
-p Create perl package (Assume Makefile.PL is there)
|
-p Create perl package (Assume Makefile.PL is there)
|
||||||
-y Create python package (Assume setup.py 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
|
-s Use sourceforge source URL
|
||||||
-c Copy a sample init.d, conf.d, and install script
|
-c Copy a sample init.d, conf.d, and install script
|
||||||
-f Force even if directory already exists
|
-f Force even if directory already exists
|
||||||
@ -427,7 +456,7 @@ check_arguments() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "acCmd:fhl:n:pyu:s" opt; do
|
while getopts "acCmd:fhl:n:pyu:sr" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
'a') set_buildtype "autotools";;
|
'a') set_buildtype "autotools";;
|
||||||
'c') cpinitd=1;;
|
'c') cpinitd=1;;
|
||||||
@ -440,6 +469,7 @@ while getopts "acCmd:fhl:n:pyu:s" opt; do
|
|||||||
'n') pkgname="$OPTARG";;
|
'n') pkgname="$OPTARG";;
|
||||||
'p') set_buildtype "perl";;
|
'p') set_buildtype "perl";;
|
||||||
'y') set_buildtype "python";;
|
'y') set_buildtype "python";;
|
||||||
|
'r') set_buildtype "rust";;
|
||||||
'u') url="$OPTARG";;
|
'u') url="$OPTARG";;
|
||||||
's') sourceforge=1;;
|
's') sourceforge=1;;
|
||||||
esac
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user