Skip to content

Commit

Permalink
app-office/scribus: Fix LINGUAS usage
Browse files Browse the repository at this point in the history
Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=583760

Package-Manager: portage-2.3.2
Signed-off-by: Justin Lecher <[email protected]>
  • Loading branch information
jlec committed Oct 29, 2016
1 parent b44b9c2 commit 8800d8c
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 77 deletions.
16 changes: 12 additions & 4 deletions app-office/scribus/scribus-1.4.6.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ KEYWORDS="amd64 hppa ppc ppc64 ~sparc x86"
IUSE="cairo debug examples hunspell +minimal +pdf scripts templates tk"

# a=$(ls resources/translations/po/scribus.*ts | sed -e 's:\.: :g' | awk '{print $2}'); echo ${a}
IUSE_LINGUAS=" af ar bg br ca cs_CZ cy da_DK de_1901 de_CH de el en_AU en_GB en_US eo es_ES et eu fi fr gl hu id it ja ko lt_LT nb_NO nl pl_PL pt_BR pt ru sa sk_SK sl sq sr sv th_TH tr uk zh_CN zh_TW"
IUSE_LINGUAS=" af ar bg br ca cs_CZ cy da_DK de@1901 de_CH de el en_AU en_GB en_US eo es_ES et eu fi fr gl hu id it ja ko lt_LT nb_NO nl pl_PL pt_BR pt ru sa sk_SK sl sq sr sv th_TH tr uk zh_CN zh_TW"
IUSE+=" ${IUSE_LINGUAS// / linguas_}"

REQUIRED_USE="
Expand Down Expand Up @@ -76,12 +76,13 @@ src_prepare() {
}

src_configure() {
local lang langs
local _lang lang langs
for lang in ${IUSE_LINGUAS}; do
_lang=$(translate_lang ${lang})
if use linguas_${lang}; then
langs+=",${lang}"
langs+=",${_lang}"
else
sed -e "/${lang}/d" -i scribus/doc/CMakeLists.txt || die
sed -e "/${_lang}/d" -i scribus/doc/CMakeLists.txt || die
fi
done

Expand Down Expand Up @@ -149,3 +150,10 @@ pkg_postrm() {
fdo-mime_desktop_database_update
fdo-mime_mime_database_update
}

translate_lang() {
_lang=${1}
[[ ${1} == "ru_RU" ]] && _lang+=_0
[[ ${1} == "de@1901" ]] && _lang=de_1901
echo ${_lang}
}
69 changes: 41 additions & 28 deletions app-office/scribus/scribus-1.5.0-r1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ KEYWORDS="~amd64 ~x86"
IUSE="+boost debug examples graphicsmagick hunspell +minimal osg +pdf scripts templates tk"

#a=$((ls resources/translations/scribus.*ts | sed -e 's:\.: :g' | awk '{print $2}'; ls resources/loremipsum/*xml | sed -e 's:\.: :g' -e 's:loremipsum\/: :g'| awk '{print $2}'; ls resources/dicts/hyph*dic | sed -e 's:\.: :g' -e 's:hyph_: :g' | awk '{print $2}'; ls resources/dicts/README_*txt | sed -e 's:_hyph::g' -e 's:\.: :g' -e 's:README_: :g' | awk '{print $2}') | sort | uniq); echo $a
IUSE_LINGUAS=" af ar bg br ca ca_ES cs cs_CZ cy cy_GB da da_DK de de_1901 de_CH de_DE el en_AU en_EN en_GB en_US eo es es_ES et eu fi fi_FI fr gl he hr hu hu_HU ia id id_ID is is_IS it ja ko ku la lt lt_LT nb_NO nl nn_NO pl pl_PL pt pt_BR pt_PT ro ro_RO ru ru_RU_0 sa sk sk_SK sl sl_SI sq sr sv sv_SE th_TH tr uk uk_UA zh_CN zh_TW"
IUSE_LINGUAS=" af ar bg br ca ca_ES cs cs_CZ cy cy_GB da da_DK de de@1901 de_CH de_DE el en_AU en_GB en_US eo es es_ES et eu fi fi_FI fr gl he hr hu hu_HU ia id id_ID is is_IS it ja ko ku la lt lt_LT nb_NO nl nn_NO pl pl_PL pt pt_BR pt_PT ro ro_RO ru ru_RU sa sk sk_SK sl sl_SI sq sr sv sv_SE th_TH tr uk uk_UA zh_CN zh_TW"
IUSE+=" ${IUSE_LINGUAS// / linguas_}"

REQUIRED_USE="
Expand Down Expand Up @@ -105,20 +105,28 @@ src_prepare() {
}

src_configure() {
local lang langs
local _lang lang langs
for lang in ${IUSE_LINGUAS}; do
_lang=$(translate_lang ${lang})
if use linguas_${lang} || [[ ${lang} == "en" ]]; then
# From the CMakeLists.txt
# "#Bit of a hack, preprocess all the filenames to generate our language string, needed for -DWANT_GUI_LANG=en_GB;de_DE , etc"
langs+=";${lang}"
langs+=";${_lang}"
else
# Don't install localized documentation
sed -e "/${lang}/d" -i doc/CMakeLists.txt || die
safe_delete file ./resources/dicts/README_${lang}.txt
safe_delete file ./resources/dicts/README_hyph_${lang}.txt
safe_delete file ./resources/dicts/hyph_${lang}.dic
safe_delete file ./resources/loremipsum/${lang}.xml
sed -e "/${_lang}/d" -i doc/CMakeLists.txt || die
safe_delete \
./resources/dicts/README_${_lang}.txt \
./resources/dicts/README_hyph_${_lang}.txt \
./resources/dicts/hyph_${_lang}.dic \
./resources/loremipsum/${_lang}.xml
fi
sed -e "/en_EN/d" -i doc/CMakeLists.txt || die
safe_delete \
./resources/dicts/README_en_EN.txt \
./resources/dicts/README_hyph_en_EN.txt \
./resources/dicts/hyph_en_EN.dic \
./resources/loremipsum/en_EN.xml
done

local mycmakeargs=(
Expand All @@ -144,10 +152,12 @@ src_configure() {
src_install() {
cmake-utils_src_install

local lang
local lang _lang
# en_EN can be deleted always
for lang in ${IUSE_LINGUAS}; do
if ! use linguas_${lang}; then
safe_delete dir "${ED}"/usr/share/man/${lang}
_lang=$(translate_lang)
safe_delete "${ED}"/usr/share/man/${_lang}
fi
done

Expand Down Expand Up @@ -184,22 +194,25 @@ pkg_postrm() {
}

safe_delete () {
case $1 in
dir)
if [[ -d "${2}" ]]; then
ebegin "Deleting ${2} recursively"
rm -r "${2}" || die
eend $?
fi
;;
file)
if [[ -f "${2}" ]]; then
ebegin "Deleting ${2}"
rm "${2}" || die
eend $?
fi
;;
*)
die "Wrong usage"
esac
local x
for x in ${@}; do
if [[ -d "${x}" ]]; then
ebegin "Deleting ${x} recursively"
rm -r "${x}" || die
eend $?
elif [[ -f "${x}" ]]; then
ebegin "Deleting ${x}"
rm "${x}" || die
eend $?
else
ewarn "${x} not found"
fi
done
}

translate_lang() {
_lang=${1}
[[ ${1} == "ru_RU" ]] && _lang+=_0
[[ ${1} == "de@1901" ]] && _lang=de_1901
echo ${_lang}
}
7 changes: 4 additions & 3 deletions app-office/scribus/scribus-1.5.2-r1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EAPI=6

PYTHON_COMPAT=( python2_7 )
PYTHON_REQ_USE="tk?"
CMAKE_MAKEFILE_GENERATOR=ninja

inherit cmake-utils fdo-mime flag-o-matic multilib python-single-r1

Expand All @@ -19,7 +20,7 @@ KEYWORDS="~amd64 ~x86"
IUSE="+boost debug examples graphicsmagick hunspell +minimal osg +pdf scripts templates tk"

#a=$((ls resources/translations/scribus.*ts | sed -e 's:\.: :g' | awk '{print $2}'; ls resources/loremipsum/*xml | sed -e 's:\.: :g' -e 's:loremipsum\/: :g'| awk '{print $2}'; ls resources/dicts/hyph*dic | sed -e 's:\.: :g' -e 's:hyph_: :g' | awk '{print $2}'; ls resources/dicts/README_*txt | sed -e 's:_hyph::g' -e 's:\.: :g' -e 's:README_: :g' | awk '{print $2}') | sort | uniq); echo $a
IUSE_LINGUAS=" af ar bg br ca ca_ES cs cs_CZ cy cy_GB da da_DK de de_1901 de_CH de_DE el en_AU en_GB en_US eo es es_ES et eu fi fi_FI fr gl he hr hu hu_HU ia id id_ID is is_IS it ja ko ku la lt lt_LT nb_NO nl nn_NO pl pl_PL pt pt_BR pt_PT ro ro_RO ru ru_RU_0 sa sk sk_SK sl sl_SI sq sr sv sv_SE th_TH tr uk uk_UA zh_CN zh_TW"
IUSE_LINGUAS=" af ar bg br ca ca_ES cs cs_CZ cy cy_GB da da_DK de de@1901 de_CH de_DE el en_AU en_GB en_US eo es es_ES et eu fi fi_FI fr gl he hr hu hu_HU ia id id_ID is is_IS it ja ko ku la lt lt_LT nb_NO nl nn_NO pl pl_PL pt pt_BR pt_PT ro ro_RO ru ru_RU sa sk sk_SK sl sl_SI sq sr sv sv_SE th_TH tr uk uk_UA zh_CN zh_TW"
IUSE+=" ${IUSE_LINGUAS// / linguas_}"

REQUIRED_USE="
Expand Down Expand Up @@ -157,7 +158,6 @@ src_install() {
_lang=$(translate_lang)
safe_delete "${ED}"/usr/share/man/${_lang}
fi
safe_delete "${ED}"/usr/share/man/${_lang}
done

if ! use scripts; then
Expand Down Expand Up @@ -211,6 +211,7 @@ safe_delete () {

translate_lang() {
_lang=${1}
# [[ ${1} == "ru_RU" ]] && _lang+=_0
[[ ${1} == "ru_RU" ]] && _lang+=_0
[[ ${1} == "de@1901" ]] && _lang=de_1901
echo ${_lang}
}
92 changes: 52 additions & 40 deletions app-office/scribus/scribus-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5
EAPI=6

PYTHON_COMPAT=( python2_7 )
PYTHON_REQ_USE="tk?"
Expand All @@ -22,7 +22,7 @@ KEYWORDS=""
IUSE="+boost debug examples graphicsmagick hunspell +minimal osg +pdf scripts templates tk"

#a=$((ls resources/translations/scribus.*ts | sed -e 's:\.: :g' | awk '{print $2}'; ls resources/loremipsum/*xml | sed -e 's:\.: :g' -e 's:loremipsum\/: :g'| awk '{print $2}'; ls resources/dicts/hyph*dic | sed -e 's:\.: :g' -e 's:hyph_: :g' | awk '{print $2}'; ls resources/dicts/README_*txt | sed -e 's:_hyph::g' -e 's:\.: :g' -e 's:README_: :g' | awk '{print $2}') | sort | uniq); echo $a
IUSE_LINGUAS=" af ar bg br ca ca_ES cs cs_CZ cy cy_GB da da_DK de de_1901 de_CH de_DE el en_AU en_EN en_GB en_US eo es es_ES et eu fi fi_FI fr gl he hr hu hu_HU ia id id_ID is is_IS it ja ko ku la lt lt_LT nb_NO nl nn_NO pl pl_PL pt pt_BR pt_PT ro ro_RO ru ru_RU_0 sa sk sk_SK sl sl_SI sq sr sv sv_SE th_TH tr uk uk_UA zh_CN zh_TW"
IUSE_LINGUAS=" af ar bg br ca ca_ES cs cs_CZ cy cy_GB da da_DK de de@1901 de_CH de_DE el en_AU en_GB en_US eo es es_ES et eu fi fi_FI fr gl he hr hu hu_HU ia id id_ID is is_IS it ja ko ku la lt lt_LT nb_NO nl nn_NO pl pl_PL pt pt_BR pt_PT ro ro_RO ru ru_RU sa sk sk_SK sl sl_SI sq sr sv sv_SE th_TH tr uk uk_UA zh_CN zh_TW"
IUSE+=" ${IUSE_LINGUAS// / linguas_}"

REQUIRED_USE="
Expand All @@ -45,7 +45,6 @@ COMMON_DEPEND="
dev-qt/qtopengl:5
dev-qt/qtprintsupport:5
dev-qt/qtquickcontrols:5
dev-qt/qtwebkit:5
dev-qt/qtwidgets:5
dev-qt/qtxml:5
media-libs/fontconfig
Expand Down Expand Up @@ -76,6 +75,7 @@ DEPEND="${COMMON_DEPEND}

PATCHES=(
"${FILESDIR}"/${PN}-1.5.0-docdir.patch
"${FILESDIR}"/${PN}-1.5.2-fpic.patch
)

src_prepare() {
Expand Down Expand Up @@ -103,24 +103,31 @@ src_prepare() {
fi

cmake-utils_src_prepare
subversion_src_prepare
}

src_configure() {
local lang langs
local _lang lang langs
for lang in ${IUSE_LINGUAS}; do
_lang=$(translate_lang ${lang})
if use linguas_${lang} || [[ ${lang} == "en" ]]; then
# From the CMakeLists.txt
# "#Bit of a hack, preprocess all the filenames to generate our language string, needed for -DWANT_GUI_LANG=en_GB;de_DE , etc"
langs+=";${lang}"
langs+=";${_lang}"
else
# Don't install localized documentation
sed -e "/${lang}/d" -i doc/CMakeLists.txt || die
safe_delete file ./resources/dicts/README_${lang}.txt
safe_delete file ./resources/dicts/README_hyph_${lang}.txt
safe_delete file ./resources/dicts/hyph_${lang}.dic
safe_delete file ./resources/loremipsum/${lang}.xml
sed -e "/${_lang}/d" -i doc/CMakeLists.txt || die
safe_delete \
./resources/dicts/README_${_lang}.txt \
./resources/dicts/README_hyph_${_lang}.txt \
./resources/dicts/hyph_${_lang}.dic \
./resources/loremipsum/${_lang}.xml
fi
sed -e "/en_EN/d" -i doc/CMakeLists.txt || die
safe_delete \
./resources/dicts/README_en_EN.txt \
./resources/dicts/README_hyph_en_EN.txt \
./resources/dicts/hyph_en_EN.dic \
./resources/loremipsum/en_EN.xml
done

local mycmakeargs=(
Expand All @@ -130,26 +137,28 @@ src_configure() {
-DWANT_DISTROBUILD=ON
-DDOCDIR="/usr/share/doc/${PF}/"
-DWANT_GUI_LANG="${langs#;};en"
$(cmake-utils_use_with pdf PODOFO)
$(cmake-utils_use_with boost)
$(cmake-utils_use_want graphicsmagick)
$(cmake-utils_use !osg WANT_NOOSG)
$(cmake-utils_use_want debug DEBUG)
$(cmake-utils_use_want minimal NOHEADERINSTALL)
$(cmake-utils_use_want hunspell HUNSPELL)
$(cmake-utils_use_want !examples NOEXAMPLES)
$(cmake-utils_use_want !templates NOTEMPLATES)
-DWITH_PODOFO="$(usex pdf)"
-DWITH_BOOST="$(usex boost)"
-DWANT_GRAPHICSMAGICK="$(usex graphicsmagick)"
-DWANT_NOOSG="$(usex !osg)"
-DWANT_DEBUG="$(usex debug)"
-DWANT_NOHEADERINSTALL="$(usex minimal)"
-DWANT_HUNSPELL="$(usex hunspell)"
-DWANT_NOEXAMPLES="$(usex !examples)"
-DWANT_NOTEMPLATES="$(usex !templates)"
)
cmake-utils_src_configure
}

src_install() {
cmake-utils_src_install

local lang
local lang _lang
# en_EN can be deleted always
for lang in ${IUSE_LINGUAS}; do
if ! use linguas_${lang}; then
safe_delete dir "${ED}"/usr/share/man/${lang}
_lang=$(translate_lang)
safe_delete "${ED}"/usr/share/man/${_lang}
fi
done

Expand Down Expand Up @@ -186,22 +195,25 @@ pkg_postrm() {
}

safe_delete () {
case $1 in
dir)
if [[ -d "${2}" ]]; then
ebegin "Deleting ${2} recursively"
rm -r "${2}" || die
eend $?
fi
;;
file)
if [[ -f "${2}" ]]; then
ebegin "Deleting ${2}"
rm "${2}" || die
eend $?
fi
;;
*)
die "Wrong usage"
esac
local x
for x in ${@}; do
if [[ -d "${x}" ]]; then
ebegin "Deleting ${x} recursively"
rm -r "${x}" || die
eend $?
elif [[ -f "${x}" ]]; then
ebegin "Deleting ${x}"
rm "${x}" || die
eend $?
else
ewarn "${x} not found"
fi
done
}

translate_lang() {
_lang=${1}
[[ ${1} == "ru_RU" ]] && _lang+=_0
[[ ${1} == "de@1901" ]] && _lang=de_1901
echo ${_lang}
}
3 changes: 1 addition & 2 deletions profiles/desc/linguas.desc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cy_GB - Welsh locale
da - Danish locale
da_DK - Danish locale for Denmark
de - German locale
de_1901 - German locale with old spelling
de@1901 - German locale with old spelling
de_CH - German locale for Switzerland
de_DE - German locale for Germany
dgo - Dogri locale for India
Expand Down Expand Up @@ -201,7 +201,6 @@ ro - Romanian locale
ro_RO - Romanian locale for Romania
ru - Russian locale
ru_RU - Russian locale for Russia
ru_RU_0 - Russian locale for Russia
rue - Rusyn locale
rw - Kinyarwanda locale
sa - Sanskrit locale
Expand Down

0 comments on commit 8800d8c

Please sign in to comment.