Skip to content

Instantly share code, notes, and snippets.

@cniw
Last active January 20, 2022 12:07
Show Gist options
  • Save cniw/05fc23a9ed26a2555b0f6060ae2902cb to your computer and use it in GitHub Desktop.
Save cniw/05fc23a9ed26a2555b0f6060ae2902cb to your computer and use it in GitHub Desktop.
Build mpv package with luajit support for Arch Linux
# set variable
_pkgbase=mpv-full-git
_pkgbase_cache_dir="$HOME/.cache/yay"
_repo_cache_dir="$HOME/Applications/git"
_git_url=https://github.com/mpv-player/mpv.git
_git_repo="${_git_url%%.git}"
_git_repo="${_git_repo##*.com/}"
# prepare source code
[ -d "${_pkgbase_cache_dir}" ] || mkdir -p "${_pkgbase_cache_dir}"
[ -d "${_repo_cache_dir}" ] || mkdir -p "${_repo_cache_dir}"
( cd "${_pkgbase_cache_dir}" && git clone "https://aur.archlinux.org/${_pkgbase}.git" ) || ( cd "${_pkgbase_cache_dir}/${_pkgbase}" && git pull )
( cd "${_repo_cache_dir}" && git clone "${_git_url}" "${_git_repo}" ) || ( cd "${_repo_cache_dir}/${_git_repo}" && git pull )
cp -r "${_pkgbase_cache_dir}/${_pkgbase}" "/tmp/${_pkgbase}"
cp -r "${_repo_cache_dir}/${_git_repo}" "/tmp/${_pkgbase}/${_pkgbase%%-*}"
cd /tmp/${_pkgbase} && sed -i -e 's/lua52/luajit/g' -e 's/52arch/luajit/g' -e 's/ffmpeg-git/ffmpeg/g' PKGBUILD
# build
makepkg -cirs
# delete build directory
cd ~ && rm -rf "/tmp/${_pkgbase}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment