summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 197fee1f617c5becb1f110cca45044c53ed48d24 (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
pkgname='kopano-libvmime-git'
pkgver=0.9.2k4
pkgrel=1
provides=(
    'libvmime=${pkgver}'
	 )
pkgdesc='A C++ class library for working with MIME messages'
arch=(
    'armv7l'
    'aarch64'
    'i686'
    'x86_64'
     )
url='http://www.vmime.org/'
license=(
    'GPL'
	)
	
_tagPrefix="v"
# template start; name=base-scm; version=1;
#_tagPrefix=""
#_tagSuffix=""

_basePkgName="${pkgname//-git/}"
if [[ "${pkgname}" == *-git ]];
then
    # Version can't be set before pkgver has run
    provides+=("${_basePkgName}=${pkgver}")
fi

_gitLogByDay() {
    local NEXT=$(date +%F)
    local SINCE="1970-01-01"
    local UNTIL=$NEXT
    local LOG_FORMAT="* %s"
    git log --no-merges --since="${SINCE}" --until="${UNTIL}" --format="%cd" --date=short --follow . | sort -u | while read DATE ; do
	local GIT_PAGER=$(git log --no-merges --reverse --format="${LOG_FORMAT}" --since="${DATE} 00:00:00" --until="${DATE} 23:59:59" --author="${AUTHOR}" --follow . | uniq)
	if [ ! -z "$GIT_PAGER" ]
	then
	    echo
	    echo -e "[$DATE]"
	    echo -e "${GIT_PAGER}"
	fi
    done
}
if [ ! -e "changelog" ] \
    || git rev-parse ;
then
    _gitLogByDay > changelog
    changelog="changelog"
fi

# https://wiki.archlinux.org/index.php/VCS_package_guidelines#Git
pkgver() {
    cd ${srcdir}/${pkgname}
    if [[ "${pkgname}" == *-git ]];
    then
	_lastTag=$(git tag -l "${_tagPrefix}*" --sort=v:refname | tail -n 1)
	_revision="$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
	if [ ! -z "${_lastTag}" ];
	then
	    echo "${_lastTag}" | sed "s|${_tagPrefix}\(.*\)${_tagSuffix}|\1.r${_revision}|"
	else
	    echo "${pkgver}" | sed "s|\(.*\)-git|1.r${_revision}|"
	fi
    else
        echo ${pkgver}
    fi
}

_sourceBranch=$(if [[ "${pkgname}" == *-git ]]; then echo "#branch=master"; else echo "#tag=${_tagPrefix}${pkgver}${_tagSuffix}"; fi)

_patchFromGit() {
    _patchDir="${srcdir}/$(basename $(pwd))-patch.git"
    if [ ! -e "${_patchDir}" ];
    then
	git clone --bare ${1} ${_patchDir}
    fi

    _sourceBranchName="${_sourceBranch//#*=/}"
    # Patch From Specific Range
    if [ ! -z "${3}" ];
    then
        git --git-dir="${_patchDir}" format-patch "^${2}" "${3}" --stdout | git apply

    # Patch From Specific Commit
    elif [ ! -z "${2}" ];
    then
	git --git-dir="${_patchDir}" format-patch -1 "${2}" --stdout | git apply

    # Patch From Dedicated Branch
    elif git --git-dir="${_patchDir}" rev-parse --verify --quiet "${_sourceBranchName}" > /dev/null \
         && git --git-dir="${_patchDir}" rev-parse --verify --quiet "${_sourceBranchName}-patch" > /dev/null ;
    then
	git --git-dir="${_patchDir}" format-patch "^${_sourceBranchName}" "${_sourceBranchName}-patch" --stdout | git apply

    else
	echo "No Patch Branch Found [${_sourceBranchName}-patch]"

    fi
}
# template end;

conflicts=(
    'zarafa-libvmime'
	  )
source=(
    "${pkgname}::git+https://github.com/Kopano-dev/vmime.git${_sourceBranch}"
	)
md5sums=(
    'SKIP'
	)

makedepends=(
    'cmake'
    'postfix'
    'doxygen'
    'xdot'
    
    # PKGBUILD dependencies
    'git'
	    )
depends=(
    'gsasl' 
    'gnutls'
	)

prepare() {
    cd ${srcdir}/${pkgname}
    _patchFromGit https://github.com/pietmacom/kopano-vmime.git
}

build() {
    mkdir build
    cd build

    cmake ../${pkgname} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIB_INSTALL_DIR=/usr/lib/ \
    -DCMAKE_BUILD_TYPE=Release

    make
}

package() {
    cd build
    make DESTDIR="$pkgdir" install
}