summaryrefslogtreecommitdiff
path: root/media-video/jubler/jubler-7.0.3.ebuild
blob: 0b14f079e2b1687ff50d7ed4a7462ee9cbd8d3d4 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Skeleton command:
# java-ebuilder --generate-ebuild --workdir . --pom pom.xml --download-uri https://github.com/teras/Jubler/archive/v7.0.3.tar.gz --slot 0 --keywords "~amd64" --ebuild jubler-7.0.3.ebuild

EAPI=8

JAVA_PKG_IUSE="doc source"
MAVEN_ID="com.panayotis.jubler:project:7.0.3"

inherit desktop java-pkg-2 java-pkg-simple toolchain-funcs xdg-utils

DESCRIPTION="Jubler Subtitle Εditor"
HOMEPAGE="https://www.jubler.org/"
SRC_URI="https://github.com/teras/Jubler/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

CP_DEPEND="dev-java/appenh:0"

DEPEND="${CP_DEPEND}
	media-video/ffmpeg:0=
	>=virtual/jdk-1.8:*"

RDEPEND="${CP_DEPEND}
	>=virtual/jre-1.8:*"

JUBLER_MODULES=(
	"jubler"
	"appenhancer"
	"aspell"
	"basetextsubs"
	"coretools"
	"mplayer"
	"zemberek"
)

HTML_DOCS=( ChangeLog.html )

PATCHES=( "${FILESDIR}/7.0.3-helpme.patch" )

S="${WORKDIR}/Jubler-${PV}"

src_prepare() {
	java-pkg-2_src_prepare
	default
	# decodeaudio.c:82:24: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' undeclared (first use in this function); did you mean 'AV_CODEC_CAP_VARIABLE_FRAME_SIZE'?
	# decodeaudio.c:176:49: error: 'CODEC_ID_NONE' undeclared (first use in this function); did you mean 'AV_CODEC_ID_NONE'?
	# decodeaudio.c:180:38: error: 'AVCodecContext' has no member named 'request_channels'; did you mean 'request_channel_layout'?
	# decodeframe.c:230:31: error: 'PIX_FMT_RGB24' undeclared (first use in this function); did you mean 'AV_PIX_FMT_RGB24'?
	# decodeaudio.c:197:79: error: 'AVIO_WRONLY' undeclared (first use in this function # https://github.com/FFmpeg/FFmpeg/commit/59d96941f0
	# decodeaudio.c:239:26: error: 'AVCodecContext' has no member named 'request_channels'; did you mean 'request_channel_layout'?
	# makecache.c:94:28: error: 'AVCODEC_MAX_AUDIO_FRAME_SIZE' undeclared (first use in this function); did you mean 'AV_CODEC_CAP_VARIABLE_FRAME_SIZE'?
	# decodeaudio.c:339:25: error: 'CODEC_FLAG_GLOBAL_HEADER' undeclared (first use in this function); did you mean 'AV_CODEC_FLAG_GLOBAL_HEADER'
	sed \
		-e 's:AVCODEC_MAX_AUDIO_FRAME_SIZE:AV_CODEC_CAP_VARIABLE_FRAME_SIZE:' \
		-e 's:CODEC_ID_NONE:AV_CODEC_ID_NONE:' \
		-e 's:request_channels:request_channel_layout:' \
		-e 's:PIX_FMT_RGB24:AV_PIX_FMT_RGB24:' \
		-e 's:AVIO_WRONLY:AVIO_FLAG_WRITE:' \
		-e 's:CODEC_FLAG_GLOBAL_HEADER:AV_CODEC_FLAG_GLOBAL_HEADER:' \
		-e 's:CodecID:AVCodecID:' \
		-i resources/ffmpeg/ffdecode/*.c || die
}

src_compile() {
	einfo "Compiling the ffdecode library"
	pushd resources/ffmpeg/ffdecode || die
		local args=(
			JAVA_HOME="$(java-config -g JAVA_HOME)"
			STATIC="no"
			CC="$(tc-getCC)"
			STRIP="$(tc-getSTRIP)"
			LIBNAME="libffdecode.so"
		)
		emake "${args[@]}"
	popd

	jar -cf coretheme.jar -C modules/coretheme/src/main/resources/ . || die
	JAVA_GENTOO_CLASSPATH_EXTRA+=":coretheme.jar"

	mv modules/{core,jubler} || die

	local module
	for module in "${JUBLER_MODULES[@]}"; do
		einfo "Compiling module \"${module}\""
		JAVA_SRC_DIR="modules/${module}/src/main/java"
		JAVA_RESOURCE_DIRS="modules/${module}/src/main/resources"
		JAVA_JAR_FILENAME="${module}.jar"
		if [[ ${module} == jubler ]]; then
			JAVA_MAIN_CLASS="Jubler"
		fi

		java-pkg-simple_src_compile
		JAVA_GENTOO_CLASSPATH_EXTRA+=":${module}.jar"
		JAVA_MAIN_CLASS=""
		rm -r target || die
	done

	if use doc; then
		einfo "Compiling javadocs"
		JAVA_SRC_DIR=()
		for module in "${JUBLER_MODULES}"; do
			JAVA_SRC_DIR+=( "modules/${module}/src/main/java" )
		done
		JAVA_JAR_FILENAME="ignoreme.jar"
		java-pkg-simple_src_compile
	fi
}

src_install() {
	java-pkg_doso dist/lib/libffdecode.so
	java-pkg_dojar "coretheme.jar"
	local module
	for module in "${JUBLER_MODULES[@]}"; do
		java-pkg_dojar ${module}.jar
		if use source; then
			java-pkg_dosrc "modules/${module}/src/main/java/*"
		fi
	done

	if use doc; then
		java-pkg_dojavadoc target/api
	fi

	java-pkg_dolauncher "jubler" --main Jubler

	domenu resources/installers/linux/jubler.desktop
	doicon -s 32 resources/installers/linux/jubler32.png
	doicon -s 64 resources/installers/linux/jubler64.png
	doicon -s 128 resources/installers/linux/jubler128.png
	doicon modules/jubler/src/main/resources/icons/splash.jpg
	doicon -s 16 modules/jubler/src/main/resources/icons/crossmobile.png

	# modules/installer/pom.xml#L90-L94
	insinto /usr/share/${PN}/lib/i18n
	doins -r resources/i18n/cache
	insinto /usr/share/${PN}/lib/help
	doins resources/help/{cache/jubler-faq.html,jubler-faq.xml,question.png}
}

pkg_postinst() {
	xdg_icon_cache_update
}

pkg_postrm() {
	xdg_icon_cache_update
}