aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses/gecko.mk
blob: 57f95814f946e19e63919b74acfb819e7d7b677b (plain) (blame)
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
# $FreeBSD$
#
# Handle dependency of different gecko based applications
#
# MAINTAINER: gecko@FreeBSD.org
#
# Feature:  gecko
# Usage:    USES=gecko or USES=gecko:ARGS
# Valid ARGS:   libxul, firefox, seamonkey, thunderbird
#       in case the first argument is not libxul
#       The following arguments are available
#       - build: also add the dependency as a build
#                dependency
#       - [0-9][0-9][+]?: a version optionnally
#                         followed by a +
#

.if !defined(_INCLUDE_USES_GECKO_MK)
_INCLUDE_USES_GECKO_MK= yes

.if empty(gecko_ARGS)
gecko_ARGS= libxul
.endif

_GECKO_VERSION= ${gecko_ARGS:M[0-9][0-9]*}

.if ${gecko_ARGS:Mlibxul}
# Compat with older versions
GECKO=  libxul
GECKO_CONFING?= ${LOCALBASE}/bin/${GECKO}-config
XPIDL?=     ${LOCALBASE}/lib/${GECKO}/xpidl
XPIDL_INCL?=    `${GECKO_CONFIG} --idlflags`

BUILD_DEPENDS+= libxul>=38:www/libxul
RUN_DEPENDS+=   libxul>=38:www/libxul

.elif ${gecko_ARGS:Mfirefox}

_GECKO_DEFAULT_VERSION= 38
_GECKO_VERSIONS=        38 45
_GECKO_TYPE=    firefox

# Dependence lines for different Firefox versions
38_DEPENDS=     ${LOCALBASE}/lib/firefox/firefox:www/firefox-esr
45_DEPENDS=     ${LOCALBASE}/lib/firefox/firefox:www/firefox

.if exists(${LOCALBASE}/bin/firefox)
_GECKO_INSTALLED_VER!=  ${LOCALBASE}/bin/firefox --version 2>/dev/null
_GECKO_INSTALLED_VER:=  ${_GECKO_INSTALLED_VER:M[0-9][0-9]*:C/([0-9][0-9]).*/\1/g}
.endif

.elif ${gecko_ARGS:Mseamonkey}

_GECKO_DEFAULT_VERSION= 39
_GECKO_VERSIONS=        39
_GECKO_TYPE=    seamonkey

.if exists(${LOCALBASE}/bin/seamonkey)
_GECKO_INSTALLED_VER!=  ${LOCALBASE}/bin/seamonkey --version 2>/dev/null
_GECKO_INSTALLED_VER:=  ${_GECKO_INSTALLED_VER:M[0-9]*:C/[0-9].([0-9][0-9]).*/\1/g}
.endif

# Dependence lines for different Seamonkey versions
39_DEPENDS=     ${LOCALBASE}/lib/seamonkey/seamonkey:www/seamonkey

.elif ${gecko_ARGS:Mthunderbird}

_GECKO_DEFAULT_VERSION= 45
_GECKO_VERSIONS=    45
_GECKO_TYPE=    thunderbird

.if exists(${LOCALBASE}/bin/thunderbird)
_GECKO_INSTALLED_VER!=  ${LOCALBASE}/bin/thunderbird --version 2>/dev/null
_GECKO_INSTALLED_VER:=  ${_GECKO_INSTALLED_VER:M[0-9][0-9]*:C/([0-9][0-9]).*/\1/g}
.endif

# Dependence lines for different Thunderbird versions
45_DEPENDS=     ${LOCALBASE}/lib/thunderbird/thunderbird:mail/thunderbird

.else
IGNORE= Unknown type of gecko dependency you may specify either libxul, firefox, seamonkey or thunderbird
.endif

.if defined(_GECKO_TYPE)
.if ${_GECKO_VERSION:M*+}
_GECKO_MIN_VERSION:=        ${_GECKO_VERSION:S/+//}
_GECKO_WANTED_VERSIONS:=    ${_GECKO_DEFAULT_VERSION}
.endif

.if ${_GECKO_VERSION:M[0-9][0-9]}
_GECKO_WANTED_VERSIONS:=    ${_GECKO_VERSION:M[0-9][0-9]}
.endif

_GECKO_WANTED_VERSIONS?=    ${_GECKO_DEFAULT_VERSION}

.if defined(_GECKO_MIN_VERSION)
.  for _v in ${_GECKO_VERSIONS}
.    if ${_GECKO_MIN_VERSION} <= ${_v}
_GECKO_WANTED_VERSIONS+=    ${_v}
.    endif
.  endfor
.endif

.for _v in ${_GECKO_WANTED_VERSIONS:O:u}
_GECKO_HIGHEST_VERSION:=    ${_v}
.if defined(_GECKO_INSTALLED_VER) && ${_GECKO_INSTALLED_VER} == ${_v}
_GECKO_WANTED_VERSION:= ${_v}
.endif
.endfor

.if !defined(_GECKO_WANTED_VERSION)
.if defined(_GECKO_INSTALLED_VER)
IGNORE= cannot install: ${_GECKO_TYPE} versions mismatch: ${_GECKO_TYPE}-${_GECKO_INSTALLED_VER} is installed and wanted version is ${_GECKO_TYPE}-${_GECKO_VERSION:M[0-9][0-9]}
.else
_GECKO_WANTED_VERSION:= ${_GECKO_HIGHEST_VERSION}
.endif
.endif


.if ${gecko_ARGS:Mbuild}
BUILD_DEPENDS+= ${${_GECKO_WANTED_VERSION}_DEPENDS}
.endif
RUN_DEPENDS+=   ${${_GECKO_WANTED_VERSION}_DEPENDS}

.endif

.endif