Skip to content

Commit

Permalink
kde5*.eclass: KDEBASE=kdel10n cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
a17r committed Aug 17, 2017
1 parent cae4e3b commit edca947
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 113 deletions.
2 changes: 0 additions & 2 deletions eclass/kde5-functions.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ esac
# kdevelop ebuild.
if [[ ${KMNAME-${PN}} = kdevelop ]]; then
KDEBASE=kdevelop
elif [[ ${KMNAME} = kde-l10n || ${PN} = kde-l10n ]]; then
KDEBASE=kdel10n
fi

debug-print "${ECLASS}: ${KDEBASE} ebuild recognized"
Expand Down
111 changes: 0 additions & 111 deletions eclass/kde5.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ else
: ${KDE_TEST:=false}
fi

# @ECLASS-VARIABLE: KDE_L10N
# @DESCRIPTION:
# This is an array of translations this ebuild supports. These translations
# are automatically added to IUSE.
if [[ ${KDEBASE} = kdel10n ]]; then
if [[ -n ${KDE_L10N} ]]; then
IUSE="${IUSE} $(printf 'l10n_%s ' ${KDE_L10N[@]})"
fi
fi

# @ECLASS-VARIABLE: KDE_SELINUX_MODULE
# @DESCRIPTION:
# If set to "none", do nothing.
Expand All @@ -150,8 +140,6 @@ KDE_UNRELEASED=( )

if [[ ${KDEBASE} = kdevelop ]]; then
HOMEPAGE="https://www.kdevelop.org/"
elif [[ ${KDEBASE} = kdel10n ]]; then
HOMEPAGE="https://l10n.kde.org"
elif [[ ${KMNAME} = kdepim ]]; then
HOMEPAGE="https://www.kde.org/applications/office/kontact/"
else
Expand Down Expand Up @@ -373,21 +361,6 @@ _calculate_src_uri() {
unset _kdebase
fi

if [[ ${KDEBASE} = kdel10n ]] ; then
local uri_base="${SRC_URI/${_kmname}-${PV}.tar.xz/}kde-l10n/kde-l10n"
SRC_URI=""
for my_l10n in ${KDE_L10N[@]} ; do
case ${my_l10n} in
sr | sr-ijekavsk | sr-Latn-ijekavsk | sr-Latn)
SRC_URI="${SRC_URI} l10n_${my_l10n}? ( ${uri_base}-sr-${PV}.tar.xz )"
;;
*)
SRC_URI="${SRC_URI} l10n_${my_l10n}? ( ${uri_base}-$(kde_l10n2lingua ${my_l10n})-${PV}.tar.xz )"
;;
esac
done
fi

if _kde_is_unreleased ; then
RESTRICT+=" fetch"
fi
Expand Down Expand Up @@ -500,16 +473,6 @@ kde5_src_unpack() {
git-r3_src_unpack
;;
esac
elif [[ ${KDEBASE} = kdel10n ]]; then
local l10npart=5
[[ ${PN} = kde4-l10n ]] && l10npart=4
mkdir -p "${S}" || die "Failed to create source dir ${S}"
cd "${S}"
for my_tar in ${A}; do
tar -xpf "${DISTDIR}/${my_tar}" --xz \
"${my_tar/.tar.xz/}/CMakeLists.txt" "${my_tar/.tar.xz/}/${l10npart}" 2> /dev/null ||
elog "${my_tar}: tar extract command failed at least partially - continuing"
done
else
default
fi
Expand All @@ -521,42 +484,6 @@ kde5_src_unpack() {
kde5_src_prepare() {
debug-print-function ${FUNCNAME} "$@"

if [[ ${KDEBASE} = kdel10n ]]; then
local l10npart=5
[[ ${PN} = kde4-l10n ]] && l10npart=4
# move known variant subdirs to root dir, currently sr@*
use_if_iuse l10n_sr-ijekavsk && _l10n_variant_subdir2root sr-ijekavsk sr
use_if_iuse l10n_sr-Latn-ijekavsk && _l10n_variant_subdir2root sr-Latn-ijekavsk sr
use_if_iuse l10n_sr-Latn && _l10n_variant_subdir2root sr-Latn sr
if use_if_iuse l10n_sr; then
rm -rf kde-l10n-sr-${PV}/${l10npart}/sr/sr@* || die "Failed to cleanup L10N=sr"
_l10n_variant_subdir_buster sr
elif [[ -d kde-l10n-sr-${PV} ]]; then
# having any variant selected means parent lingua will be unpacked as well
rm -r kde-l10n-sr-${PV} || die "Failed to remove sr parent lingua"
fi

cat <<-EOF > CMakeLists.txt || die
project(${PN})
cmake_minimum_required(VERSION 2.8.12)
EOF
# add all l10n directories to cmake
if [[ -n ${A} ]]; then
cat <<-EOF >> CMakeLists.txt || die
$(printf "add_subdirectory( %s )\n" \
`find . -mindepth 1 -maxdepth 1 -type d | sed -e "s:^\./::"`)
EOF
fi

# for KF5: drop KDE4-based part; for KDE4: drop KF5-based part
case ${l10npart} in
5) find -maxdepth 2 -type f -name CMakeLists.txt -exec \
sed -i -e "/add_subdirectory(4)/ s/^/#DONT/" {} + || die ;;
4) find -maxdepth 2 -type f -name CMakeLists.txt -exec \
sed -i -e "/add_subdirectory(5)/ s/^/#DONT/" {} + || die ;;
esac
fi

cmake-utils_src_prepare

# only build examples when required
Expand Down Expand Up @@ -807,42 +734,4 @@ kde5_pkg_postrm() {
xdg_pkg_postrm
}

_l10n_variant_subdir2root() {
local l10npart=5
[[ ${PN} = kde4-l10n ]] && l10npart=4
local lingua=$(kde_l10n2lingua ${1})
local src=kde-l10n-${2}-${PV}
local dest=kde-l10n-${lingua}-${PV}/${l10npart}

# create variant rootdir structure from parent lingua and adapt it
mkdir -p ${dest} || die "Failed to create ${dest}"
mv ${src}/${l10npart}/${2}/${lingua} ${dest}/${lingua} || die "Failed to create ${dest}/${lingua}"
cp -f ${src}/CMakeLists.txt kde-l10n-${lingua}-${PV} || die "Failed to prepare L10N=${1} subdir"
echo "add_subdirectory(${lingua})" > ${dest}/CMakeLists.txt ||
die "Failed to prepare ${dest}/CMakeLists.txt"
cp -f ${src}/${l10npart}/${2}/CMakeLists.txt ${dest}/${lingua} ||
die "Failed to create ${dest}/${lingua}/CMakeLists.txt"
sed -e "s/${2}/${lingua}/" -i ${dest}/${lingua}/CMakeLists.txt ||
die "Failed to prepare ${dest}/${lingua}/CMakeLists.txt"

_l10n_variant_subdir_buster ${1}
}

_l10n_variant_subdir_buster() {
local l10npart=5
[[ ${PN} = kde4-l10n ]] && l10npart=4
local dir=kde-l10n-$(kde_l10n2lingua ${1})-${PV}/${l10npart}/$(kde_l10n2lingua ${1})

case ${l10npart} in
5) sed -e "/^add_subdirectory(/d" -i ${dir}/CMakeLists.txt || die "Failed to cleanup ${dir} subdir" ;;
4) sed -e "/^macro.*subdirectory(/d" -i ${dir}/CMakeLists.txt || die "Failed to cleanup ${dir} subdir" ;;
esac

for subdir in $(find ${dir} -mindepth 1 -maxdepth 1 -type d | sed -e "s:^\./::"); do
if [[ ${subdir##*/} != "cmake_modules" ]] ; then
echo "add_subdirectory(${subdir##*/})" >> ${dir}/CMakeLists.txt || die
fi
done
}

fi

0 comments on commit edca947

Please sign in to comment.