We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

view app-office/softmaker-office/softmaker-office-2021.1034.ebuild @ 249:0685ed0fb913

[sync] imported 2c6bf87..18f98a6 from upstream commit 18f98a6f47cd77c1007b60dbfc7a838ffa99df0c Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 21:11:43 2023 +0200 app-crypt/acmetool: version bump to 0.2.2 commit ee2df4ec1deab61cd7bb7de2cd13ffdd066cc41a Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:30:58 2023 +0200 app-crypt/acmetool: split 0.2.1 from 9999, changed dependencies commit f3c9cf1c7a24619446390b0b71bf5bc090dfce77 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:29:33 2023 +0200 removed dependency to go-overlay commit b2057a9b0ba65917f3840a6b121c1e78397c4723 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:27:28 2023 +0200 golang eclasses: prefixed exported functions x-mgcf- commit e8d02d1edc997fec9e0b1e5d053a5b82ca4accf2 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:08:52 2023 +0200 renamed golang eclasses, updated maintainer, added disclaimer commit 748ea4be8ee777bc788cb2a8801b118b41e6f8aa Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 18:43:56 2023 +0200 copied eclasses for Go from go-overlay Reason: These eclasses are used to build app-crypt/acmetool. We previously imported go-overlay as a master repository to use the eclasses defined there but the overlay has been removed from official Gentoo overlay index due to inactivity. The removal broke new initial checkouts for this repository as go-overlay can no longer be found. Gentoo bug for MegaCoffee: https://bugs.gentoo.org/903167 Gentoo bug that caused removal: https://bugs.gentoo.org/864653 Original repository: https://github.com/Dr-Terrible/go-overlay
author Migration Sync <gentoo-overlay@megacoffee.net>
date Mon, 27 Mar 2023 19:15:01 +0000
parents 72d820887c21
children
line wrap: on
line source

# Copyright 1999-2021 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop xdg-utils

DESCRIPTION="SoftMaker Office - an office suite featuring a word processor (TextMaker), spreadsheets (PlanMaker) and slides software (Presentations)"
HOMEPAGE="https://www.softmaker.com/en/softmaker-office"

SRC_URI="https://www.softmaker.net/down/softmaker-office-${PV//\./-}-amd64.tgz"

LICENSE="SoftMakerOffice"
SLOT="0"
KEYWORDS="~amd64"

# .dep dependencies as of 20 Oct 2021, version 2021-1034:
#
#   DEBIAN                               GENTOO
#
#   libcurl4 | libcurl3 (>= 7.16.2)   => net-misc/curl
#   libc6 (>= 2.17)                   => sys-libs/glibc
#   libgcc1 (>= 1:4.2)                => sys-devel/gcc
#   libgl1-mesa-glx | libgl1          => virtual/opengl
#   libstdc++6 (>= 5.2)               => sys-devel/gcc
#   libx11-6                          => x11-libs/libX11
#   libxext6                          => x11-libs/libXext
#   libxmu6                           => x11-libs/libXmu
#   libxrandr2 (>= 2:1.2.99.3)        => x11-libs/libXrandr
#   libxrender1                       => x11-libs/libXrender

DEPEND="
	app-arch/tar
	app-arch/xz-utils
"
RDEPEND="${DEPEND}
	net-misc/curl
	sys-libs/glibc
	sys-devel/gcc
	virtual/opengl
	x11-libs/libX11
	x11-libs/libXext
	x11-libs/libXmu
	x11-libs/libXrandr
	x11-libs/libXrender
"

S="${WORKDIR}"

INNER_ARCHIVE="office2021.tar.lzma"
EXTRACTED_INNER_ARCHIVE="${WORKDIR}/extracted"

FINAL_INSTALL_DIR="/opt/softmaker-office"
INSTALL_DIR="${D}${FINAL_INSTALL_DIR}"

# disable QA check for pre-stripped binaries
QA_PRESTRIPPED="
	${FINAL_INSTALL_DIR}/dpf3/libgamorphDpf.so
	${FINAL_INSTALL_DIR}/dpf3/libsprt4-5-1.so
	${FINAL_INSTALL_DIR}/dpf3/libdpf.so.3
	${FINAL_INSTALL_DIR}/dpf3/libsx.so
	${FINAL_INSTALL_DIR}/dpf3/libsprt4-5-1-instance-03.so
	${FINAL_INSTALL_DIR}/dpf3/libCTokenizer.so
	${FINAL_INSTALL_DIR}/dpf3/libSGAnalyseSP.so
	${FINAL_INSTALL_DIR}/dpf3/libsprt4-5-1-instance-01.so
	${FINAL_INSTALL_DIR}/dpf3/libDpfDict.so
	${FINAL_INSTALL_DIR}/dpf3/libsprt4-5-1-instance-02.so
	${FINAL_INSTALL_DIR}/dpf3/libCSegmentation.so
	${FINAL_INSTALL_DIR}/textmaker
	${FINAL_INSTALL_DIR}/presentations
	${FINAL_INSTALL_DIR}/planmaker
"

# disable QA checks for upstream .desktop files
QA_DESKTOP_FILE="
	usr/share/applications/planmaker-2021.desktop
	usr/share/applications/presentations-2021.desktop
	usr/share/applications/textmaker-2021.desktop
"

src_unpack() {
	unpack ${A} || "Failed to unpack outer archive"
	
	mkdir ${EXTRACTED_INNER_ARCHIVE}
	cd ${EXTRACTED_INNER_ARCHIVE} || die "Failed to switch to extraction directory"
	
	tar xJf ${WORKDIR}/${INNER_ARCHIVE} || die "Failed to extract ${INNER_ARCHIVE}"
}

src_prepare() {
	## extract all lines defining functions from original install script so we can import it
	# first make sure we actually have the expected revision
	expected_hash="d9a7f0e21b15d226f203c3e74e42bdb3"
	actual_hash=$(md5sum "${WORKDIR}/installsmoffice" | cut -c'-32')
	[[ "${actual_hash}" == "${expected_hash}" ]] || die "Unexpected file hash on install script, unable to extract functions. Expected MD5 ${expected_hash}, got: ${actual_hash}"
	
	# extract
	tail -n 1566 ${WORKDIR}/installsmoffice | head -n 1328 >${WORKDIR}/smoffice-install-functions.sh
	
	# mandatory since EAPI 6
	eapply_user
}

src_compile() {
	. ${WORKDIR}/smoffice-install-functions.sh
	
	# set variables needed by original install script
	APPBINPATH="${WORKDIR}" # install script function will write there during installation
	SRCPATH="${EXTRACTED_INNER_ARCHIVE}" # install script function will read from there during installation
	APPPATH="${FINAL_INSTALL_DIR}" # generated script will run files from there after installation

	## create_script
	UNINSTALLSCRIPT="${APPBINPATH}/uninstall_smoffice2021" # irrelevant but function will generate that file nevertheless
	REMOVEICONSSCRIPT="${APPBINPATH}/remove_icons.sh" # also irrelevant but needed
	
	# somehow the base file for the (irrelevant) uninstall script does not exist after unpacking, replace by dummy
	echo '#dummy' >$SRCPATH/mime/uninst1
	
	# run original create_script function
	# arg 1 = version
	# arg 2 = fixed to "1" by original install script
	# arg 3 = empty to indicate global installation
	(set -e; create_script 2021 "1" "") || die "Failed to run original create_script"

	## create_desktop1 to create .desktop files
	# run original create_desktop functions
	# arg 1 = version
	# arg 2 = "0" assumes /usr/bin for installation, "1" uses APPBINPATH which would be wrong for this ebuild
	(set -e; create_desktop1 2021 "0") || die "Failed to run original create_desktop1"
	
	## do not run create_desktop2 as it would install the files (this will be done separately by this ebuild)
}

src_install() {
	# all pre-built binaries should go into /opt and be symlinked to usr/bin etc.
	
	# copy everything from inner archive to /opt install dir
	insinto ${FINAL_INSTALL_DIR}
	doins -r ${EXTRACTED_INNER_ARCHIVE}/*

	# redo the executables (otherwise they miss permission)
	exeinto ${FINAL_INSTALL_DIR}
	doexe ${EXTRACTED_INNER_ARCHIVE}/planmaker
	doexe ${EXTRACTED_INNER_ARCHIVE}/presentations
	doexe ${EXTRACTED_INNER_ARCHIVE}/textmaker

	# install the original wrapper scripts to /usr/bin
	dobin ${WORKDIR}/planmaker21
	dobin ${WORKDIR}/presentations21
	dobin ${WORKDIR}/textmaker21

	# symlink .desktop entries
	for app in planmaker presentations textmaker; do
		dosym ${FINAL_INSTALL_DIR}/mime/${app}-2021.desktop /usr/share/applications/${app}-2021.desktop
	done
	
	# MIME definition
	# TODO: split to separate files?
	# TODO: separate SoftMaker Office's own from generic definitions? (generic = MS Office etc.)
	insinto /usr/share/mime/application/
	doins /opt/softmaker-office/mime/softmaker-office-2021.xml
	
	## icons (see original copy_icons function)
	# TODO: don't install what we don't need when separated
	# 1024 is not supported by desktop eclass yet

	# app icons
	for app in prl tml pml; do
		for size in 16 24 32 48 64 128 256 512; do
			newicon -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/${app}_${size}.png" "application-x-${app}21.png"
		done
	done
	
	# MIME icons
	for size in 16 24 32 48 64 128 256 512; do
		## text documents
		# SoftOffice => tmd icon
		for mime in application-x-tmd application-x-tmv; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/tmd_${size}.png" ${mime}.png
		done
		
		# MS Office => tmd_mso icon
		for mime in application-rtf text-rtf application-msword application-msword-template application-vnd.ms-word application-x-doc application-x-pocket-word application-vnd.openxmlformats-officedocument.wordprocessingml.document application-vnd.openxmlformats-officedocument.wordprocessingml.template application-vnd.ms-word.document.macroenabled.12 application-vnd.ms-word.template.macroenabled.12; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/tmd_mso_${size}.png" ${mime}.png
		done
		
		# OpenDocument => tmd_oth icon
		for mime in application-x-pocket-word application-vnd.oasis.opendocument.text text-rtf application-vnd.sun.xml.writer application-vnd.sun.xml.writer.template application-vnd.wordperfect application-vnd.oasis.opendocument.text-template application-vnd.oasis.opendocument.text application-vnd.sun.xml.writer application-vnd.sun.xml.writer.template application-x-dbf; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/tmd_oth_${size}.png" ${mime}.png
		done
		
		## spreadsheet documents
		# SoftOffice? => pmd icon
		for mime in application-x-pmd application-x-pmv application-x-pmdx application-x-pagemaker; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/pmd_${size}.png" ${mime}.png
		done
		
		# MS Office => pmd_mso icon
		for mime in application-x-sylk application-excel application-x-excel application-x-ms-excel application-x-msexcel application-x-xls application-xls application-vnd.ms-excel application-vnd.openxmlformats-officedocument.spreadsheetml.sheet application-vnd.openxmlformats-officedocument.spreadsheetml.template application-vnd.ms-excel.sheet.macroenabled.12 application-vnd.ms-excel.template.macroenabled.12 text-spreadsheet; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/pmd_mso_${size}.png" ${mime}.png
		done
		
		# OpenDocument and generic? => pmd_oth icon
		for mime in text-csv application-x-dif application-x-prn application-vnd.stardivision.calc; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/pmd_oth_${size}.png" ${mime}.png
		done
		
		## presentations
		# SoftOffice => prd icon
		for mime in application-x-prd application-x-prs application-x-prv; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/prd_${size}.png" ${mime}.png
		done
		
		# MS Office => prd_mso icon
		for mime in application-ppt application-mspowerpoint application-vnd.ms-powerpoint application-vnd.ms-powerpoint.presentation.macroenabled.12 application-vnd.ms-powerpoint.slideshow.macroEnabled.12 application-vnd.openxmlformats-officedocument.presentationml.presentation application-vnd.openxmlformats-officedocument.presentationml.template application-vnd.openxmlformats-officedocument.presentationml.slideshow; do
			newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/prd_mso_${size}.png" ${mime}.png
		done
		
		## trailing in original function
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/tmd_${size}.png" application-x-tmd.png
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/tmd_mso_${size}.png" application-x-tmd-mso.png
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/tmd_oth_${size}.png" application-x-tmd-oth.png
		
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/pmd_${size}.png" application-x-pmd.png
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/pmd_mso_${size}.png" application-x-pmd-mso.png
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/pmd_oth_${size}.png" application-x-pmd-oth.png
		
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/prd_${size}.png" application-x-prd.png
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/prd_mso_${size}.png" application-x-prd-mso.png
		newicon -c mimetypes -s ${size} "${EXTRACTED_INNER_ARCHIVE}/icons/prd_oth_${size}.png" application-x-prd-oth.png
	done
	
	# TODO: what about the provided fonts, theres no global registration in the original install script?
}

pkg_postinst() {
	xdg_icon_cache_update
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}

pkg_postrm() {
	xdg_icon_cache_update
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}