Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Last active November 24, 2025 01:55
Show Gist options
  • Select an option

  • Save lidgnulinux/a0b254a02fd5cc4280f4607cf01ac0c5 to your computer and use it in GitHub Desktop.

Select an option

Save lidgnulinux/a0b254a02fd5cc4280f4607cf01ac0c5 to your computer and use it in GitHub Desktop.
Attempt to build & create package using makefile.
# include build.mk
COMMENT = test
V = 0
PKGNAME = test
REVISION = 0
CATEGORIES = misc
ARCH = amd64
BUILDDIR = sources
ARCHIVE = sources.tar.gz
FORMAT = ${PKGNAME}_${V}_${ARCH}-${REVISION}@${CATEGORIES}
prepare:
mkdir -p package src
extract:
@if [ ! -d $(PWD)/${BUILDDIR} ]; then \
tar -xvf ${ARCHIVE} -C src; \
else \
echo "Source's package already extracted."; \
fi
install-package:
mkdir -p package/${FORMAT}
mkdir -p package/${FORMAT}/etc/test
mkdir -p package/${FORMAT}/var/lib/mk
install -Dm644 $(PWD)/src/${BUILDDIR}/test.txt \
package/${FORMAT}/etc/test
install -Dm644 $(PWD)/Makefile \
package/${FORMAT}/var/lib/mk/${PKGNAME}.mk
create-package:
tar -C package -czvf ${FORMAT}.tar.gz .
echo "Cleanup the source & package directory."
rm -rf package src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment