summaryrefslogtreecommitdiffhomepage
path: root/dist/dist_minipix.dist
blob: 04267d3becbf1f17847252f16e73b02841993d9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# set +o errexit -o noglob is assumed.
#

pkgp_dist_minipix_is_newer() {
	local _new_fname="${1}" _new_ts="" _old_dname="${2}" _old_ts="";
	if ! _old_ts="$(stat -c %Y "${_old_dname%%/}/${_new_fname##*/}" 2>/dev/null)"	\
	|| !  _new_ts="$(stat -c %Y "${_new_fname}" 2>/dev/null)"; then
		return 0;
	elif [ "${_new_ts}" -gt "${_old_ts}" ]; then
		return 0;
	else
		return 1;
	fi;
};

pkg_dist_minipix_all() {
	local _dname="" _fname="" _pname="";
	if rtl_lmatch "${ARG_DIST}" "minipix" ","; then
		for _dname in "${PREFIX_MINIPIX}/bin" "${PREFIX_MINIPIX}/share"; do
			if [ ! -e "${_dname}" ]; then
				rtl_fileop mkdir "${_dname}";
			fi;
		done;
		for _fname in clear reset tset; do
			if [ -e "${PREFIX_NATIVE}/bin/${_fname}" ]\
			&& pkgp_dist_minipix_is_newer "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin"; then
				rtl_fileop cp_follow "${PREFIX_NATIVE}/bin/${_fname}" "${PREFIX_MINIPIX}/bin";
			fi;
		done;
		for _pname in $([ -e "${PREFIX}/minipix_dist/bin" ] && find "${PREFIX}/minipix_dist/bin"	\
				-maxdepth 1 -perm /a=x -type f -and \( -not -name "lib*" \)); do
			if pkgp_dist_minipix_is_newer "${_pname}" "${PREFIX_MINIPIX}/bin"; then
				rtl_fileop cp_follow "${_pname}" "${PREFIX_MINIPIX}/bin";
			fi;
		done;
		for _fname in libc.so libcrypto.so.45 libexpat.so.1 liblzma.so.5 libmagic.so.1			\
				libncurses.so.6 libncursesw.so.6 libpcre.so.1 libperk.so.0			\
				libpsxscl.so libpython2.7.so.1 libreadline.so.7 libssl.so.47			\
				libu16ports.so.0 libtinfo.so.6 libtinfow.so.6 libunistring.so.2			\
				libuuid.so.1; do
			if [ -e "${PREFIX_NATIVE}/lib/${_fname}" ]\
			&& pkgp_dist_minipix_is_newer "${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin"; then
				rtl_fileop cp_follow								\
					"${PREFIX_NATIVE}/lib/${_fname}" "${PREFIX_MINIPIX}/bin";
			fi;
		done;
		for _dname in lib/python2.7 share/gdb; do
			if [ -d "${PREFIX}/minipix_dist/${_dname}" ]; then
				tar -C "${PREFIX}/minipix_dist" -cpf - "${_dname}" | tar -C "${PREFIX_MINIPIX}" -xpf -;
			fi;
		done;
		for _fname in nano vim; do
			if [ -e "${PREFIX}/minipix_dist/share/${_fname}" ]\
			&& pkgp_dist_minipix_is_newer "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share"; then
				rtl_fileop cp_follow "${PREFIX}/minipix_dist/share/${_fname}" "${PREFIX_MINIPIX}/share";
			fi;
		done;
		if [ ! -L "${PREFIX_MINIPIX}/share/nanorc" ]; then
			rtl_fileop ln_symbolic "nano/nanorc.nanorc" "${PREFIX_MINIPIX}/share/nanorc";
		fi;
		if [ ! -L "${PREFIX_MINIPIX}/share/vimrc" ]; then
			rtl_fileop ln_symbolic "vim/vim74/vimrc_example.vim" "${PREFIX_MINIPIX}/share/vimrc";
		fi;
		for _fname in putty putty-256color screen screen-256color xterm xterm-256color; do
			_dname="share/terminfo/${_fname%${_fname#[a-zA-Z]}}";
			if [ ! -e "${PREFIX_MINIPIX}/${_dname}" ]; then
				rtl_fileop mkdir "${PREFIX_MINIPIX}/${_dname}";
			fi;
			if [ -e "${PREFIX_NATIVE}/${_dname}/${_fname}" ]\
			&& pkgp_dist_minipix_is_newer "${PREFIX_NATIVE}/${_dname}/${_fname}" "${PREFIX_MINIPIX}/${_dname}"; then
				rtl_fileop cp_follow "${PREFIX_NATIVE}/${_dname}/${_fname}" "${PREFIX_MINIPIX}/${_dname}";
			fi;
		done;
	fi;
};

# vim:filetype=sh