Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone
Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
#

pkg_install() {
	ex_rtl_fileop mkdir "${PKG_PREFIX}";
	find "${PKG_DESTDIR}"				\
		-type d -exec chmod 0755 {} \;;
	find "${PKG_DESTDIR}"				\
		\( -not -perm /0111 \)			\
		-type f -exec chmod 0644 {} \;;
	find "${PKG_DESTDIR}"				\
		-perm /0111 -type f -exec chmod 0755 {} \;;
	tar -C "${PKG_DESTDIR}" -cpf - .		|\
		tar -C "${PKG_PREFIX}" --overwrite -xpf -;
	if [ "${ARG_PACKAGE:-0}" -eq 1 ]; then
		tar -C "${PKG_DESTDIR}" -cpf - .	|\
			gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz"
	fi;
	if [ "${ARG_RPM:-0}" -eq 1 ]\
	&& [ -x "$(which rpmbuild 2>/dev/null)" ]; then
		cat > "${PKG_BASE_DIR}/${PKG_NAME}.spec" <<EOF
Name:           ${PKG_NAME}
Version:        ${PKG_VERSION}
Release:        1
Summary:        ${PKG_NAME} ${PKG_VERSION}
License:        Unknown
Group:          Applications
Url:            ${PKG_URL}

%description
${PKG_NAME} ${PKG_VERSION}

%prep
%build
%install
cp -pPr ${PKG_DESTDIR}/. .

%post
%postun
%files
%changelog

EOF
		rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${PKG_VERSION}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}.spec";
		find "${PREFIX_RPM}/${PKG_NAME}-${PKG_VERSION}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;;
		ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${PKG_VERSION}";
	fi;
};

# vim:filetype=sh