Next time you think about making a PKGBUILD, you might want to check the wiki first
https://wiki.archlinux.org/index.php...ging_Standards
Especially the .proto pkgbuild examples in /usr/share/pacman are a great start.
makepkg/PKGBUILD have source downloading , checksumming & extracting for many file formats buildin.
In short :
you put source URLs in the source array
Their MD5 checksums go in the md5sums array . (there are other options like sha512 for checksums, but MD5 is the most common one)
Makepkg will download the files, verify the checksums and abort if they don't match.
If the checksums do match, the sources will be extracted to $srcdir.
No need to download/extract the source files yourself.