sys-apps/isd: new package
[gentoo-zh.git] / app-office / freeoffice / freeoffice-1064.ebuild
blob9ad97fa24f0c546762bc84561146f0f20e4bb2c7
1 # Copyright 1999-2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit desktop pax-utils xdg
8 DESCRIPTION="A complete, free Microsoft Office-compatible alternative office suite."
9 HOMEPAGE="https://www.freeoffice.com"
10 BASE_URI="https://www.softmaker.net/down/softmaker-freeoffice-2021-${PV}"
11 SRC_URI="${BASE_URI}-amd64.tgz"
13 S="${WORKDIR}"
15 LICENSE="SoftMaker"
16 SLOT="0"
17 KEYWORDS="~amd64"
18 LANGUAGES="ar bg da de el en-GB en-US es et fi fr hu id it ja kk ko lt lv nl pl pt pt-BR ro ru sl sv tr uk zh"
19 for lang in ${LANGUAGES}; do
20         IUSE+="l10n_${lang%:*} "
21 done
23 RESTRICT="mirror strip"
25 DEPEND="
26         app-admin/chrpath
27         app-arch/xz-utils"
28 RDEPEND="
29         ${DEPEND}
30         media-libs/mesa
31         net-misc/curl
32         x11-libs/libXrandr
33         dev-util/desktop-file-utils
34         dev-util/gtk-update-icon-cache
35         media-libs/libglvnd
36         x11-misc/xdg-utils"
38 QA_PRESTRIPPED="*"
39 QA_PREBUILT="*"
40 QA_FLAGS_IGNORED="*"
42 font_clean(){
43         for lang in ${LANGUAGES}; do
44                 use l10n_${lang%:*} && continue
45                 declare suf
46                 case ${lang%:*} in
47                         zh-CN)
48                                 suf="sc";;
49                         ko)
50                                 suf="kr";;
51                         ja)
52                                 suf="jp";;
53                 esac
54                 rm fonts/NotoSansCJK${suf}-Regular.otf
55         done
58 free_clean(){
59         for lang in ${LANGUAGES}; do
60                 use l10n_${lang%:*} && continue
61                 declare fix
62                 case ${lang%:*} in
63                         de)
64                                 fix="de";;
65                 esac
66                 rm *free_${fix}.pdf
67         done
70 lang_clean(){
71 for lang in ${LANGUAGES}; do
72                 use l10n_${lang%:*} && continue
73                 declare suffix
74                 case ${lang%:*} in
75                         da)
76                                 suffix="dk";;
77                         el)
78                                 suffix="gr";;
79                         en-US)
80                                 suffix="us";;
81                         en-GB)
82                                 suffix="uk";;
83                         et)
84                                 suffix="ee";;
85                         ja)
86                                 suffix="jp";;
87                         kk)
88                                 suffix="kz";;
89                         ko)
90                                 suffix="kr";;
91                         pt-BR)
92                                 suffix="pb";;
93                         sl)
94                                 suffix="si";;
95                         sv)
96                                 suffix="se";;
97                         uk)
98                                 suffix="ua";;
99                         *)
100                                 suffix="${lang%:*}";;
101                 esac
102                 rm *_${suffix}.dwr
103         done
107 doc_clean(){
108 for lang in ${LANGUAGES}; do
109                 use l10n_${lang%:*} && continue
110                 declare doc
111                 case ${lang%:*} in
112                         da)
113                                 doc="dk";;
114                         el)
115                                 doc="gr";;
116                         en-US)
117                                 doc="us";;
118                         en-GB)
119                                 doc="uk";;
120                         et)
121                                 doc="ee";;
122                         ja)
123                                 doc="jp";;
124                         kk)
125                                 doc="kz";;
126                         ko)
127                                 doc="kr";;
128                         pt-BR)
129                                 doc="pb";;
130                         sl)
131                                 doc="si";;
132                         sv)
133                                 doc="se";;
134                         uk)
135                                 doc="ua";;
136                         *)
137                                 doc="${lang%:*}";;
138                 esac
139                 rm inst/*_${doc}.zip
140         done
144 src_unpack() {
145         :
148 src_install(){
149         mkdir -p "${ED}/usr/lib64/${PN}"
150         cd "${ED}/usr/lib64/${PN}"
152         unpack ${A}
153         xz -d "freeoffice2021.tar.lzma" || die
154         tar x -f "freeoffice2021.tar" \
155                 && rm "freeoffice2021.tar" || die
156         rm "installfreeoffice"
158         chrpath --delete "textmaker"
159         chrpath --delete "planmaker"
160         chrpath --delete "presentations"
162         font_clean
163         lang_clean
164         free_clean
165         doc_clean
167         for m in "${FILESDIR}"/*.desktop; do
168                 domenu "${m}"
169         done
171         for size in 16 24 32 48 64 128 256 512; do
172                 newicon -s ${size} icons/pml_${size}.png ${PN}-planmaker.png
173                 newicon -s ${size} icons/prl_${size}.png ${PN}-presentations.png
174                 newicon -s ${size} icons/tml_${size}.png ${PN}-textmaker.png
175         done
177         insinto /usr/share/mime/packages
178         doins mime/softmaker-freeoffice21.xml
180         pax-mark -m "${ED}"/usr/lib64/${PN}/planmaker
181         pax-mark -m "${ED}"/usr/lib64/${PN}/presentations
182         pax-mark -m "${ED}"/usr/lib64/${PN}/textmaker
185 pkg_postinst(){
186         einfo
187         elog "In order to use Softmaker Freeoffice, you need a serial number."
188         elog "To obtain a valid free serial number, please visit"
189         elog "https://www.freeoffice.com/en/download"
190         einfo
191         xdg_pkg_postinst