Browse code

community release

Nat! authored on 06-06-2017 14:09:50
Showing 5 changed files
... ...
@@ -5,4 +5,4 @@
5 5
 #
6 6
 # in case upstream tries to clobber it
7 7
 #
8
-https://github.com/mulle-nat
8
+https://github.com/mulle-objc
... ...
@@ -17,10 +17,8 @@ before_install:
17 17
    - git clone https://github.com/Linuxbrew/brew.git /home/linuxbrew/.linuxbrew
18 18
    - PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
19 19
    - brew update
20
-   - brew tap mulle-kybernetik/software
21
-   - brew install mulle-build
22
-
20
+   - brew install mulle-kybernetik/software/mulle-build
23 21
 
24 22
 script:
25
-   - mulle-build
23
+   - mulle-build --bootstrap
26 24
    - mulle-test
... ...
@@ -1,3 +1,9 @@
1
+0.5.14
2
+===
3
+
4
+* community release
5
+
6
+
1 7
 0.5.13
2 8
 ===
3 9
 
... ...
@@ -1,8 +1,40 @@
1
-#! /bin/sh
1
+#! /usr/bin/env bash
2 2
 #
3
-# (c) 2016 Nat! for Mulle kybernetiK
3
+#   Copyright (c) 2017 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
4 5
 #
5
-# BSD3-License
6
+#   Redistribution and use in source and binary forms, with or without
7
+#   modification, are permitted provided that the following conditions are met:
8
+#
9
+#   Redistributions of source code must retain the above copyright notice, this
10
+#   list of conditions and the following disclaimer.
11
+#
12
+#   Redistributions in binary form must reproduce the above copyright notice,
13
+#   this list of conditions and the following disclaimer in the documentation
14
+#   and/or other materials provided with the distribution.
15
+#
16
+#   Neither the name of Mulle kybernetiK nor the names of its contributors
17
+#   may be used to endorse or promote products derived from this software
18
+#   without specific prior written permission.
19
+#
20
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+#   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
+#   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24
+#   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+#   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+#   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+#   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
+#   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
+#   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+#   POSSIBILITY OF SUCH DAMAGE.
31
+#
32
+
33
+
34
+# Define your project and the dependencies for homebrew
35
+# DEPENDENCIES and BUILD_DEPENDENCIES will be evaled later!
36
+# Then run this as
37
+#   ./bin/release.sh --publisher mulle-nat --publisher-tap mulle-kybernetik/alpha/
6 38
 #
7 39
 
8 40
 PROJECT="MulleVararg"    # requires camel-case
... ...
@@ -10,61 +42,227 @@ DESC="Access variable arguments in struct layout fashion"
10 42
 DEPENDENCIES='${DEPENDENCY_TAP}/mulle-c11' # no camel case, will be evaled later!
11 43
 LANGUAGE=c               # c,cpp, objc
12 44
 
45
+
13 46
 #
14
-# Ideally you don't hafta change anything below this line
47
+# Keep these commented out, if the automatic detection works well
48
+# enough for you
15 49
 #
16
-# source mulle-homebrew.sh (clumsily)
17
-MULLE_BOOTSTRAP_FAIL_PREFIX="release.sh"
50
+# VERSIONFILE=
51
+# VERSIONNAME=
18 52
 
19
-. ./bin/repository-info.sh || exit 1
20
-. ./bin/mulle-homebrew/mulle-homebrew.sh || exit 1
53
+#
54
+# Specify needed homebrew packages by name as you would when saying
55
+# `brew install`.
56
+#
57
+# Use the ${DEPENDENCY_TAP} prefix for non-official dependencies.
58
+#
59
+# DEPENDENCIES='${DEPENDENCY_TAP}mulle-concurrent
60
+# libpng
61
+# '
62
+
63
+BUILD_DEPENDENCIES='${BOOTSTRAP_TAP}mulle-bootstrap
64
+${BOOTSTRAP_TAP}mulle-build
65
+cmake'
21 66
 
22 67
 
68
+#######
69
+# If you are using mulle-build, you don't hafta change anything after this
70
+#######
71
+
72
+#
73
+# Generate your `def install` `test do` lines here to stdout.
74
+#
75
+generate_brew_formula_build()
76
+{
77
+   local project="$1"
78
+   local name="$2"
79
+   local version="$3"
80
+
81
+   generate_brew_formula_mulle_build "${project}" "${name}" "${version}"
82
+   generate_brew_formula_mulle_test  "${project}" "${name}" "${version}"
83
+}
84
+
85
+
86
+#
87
+# If you are unhappy with the formula in general, then change
88
+# this function. Print your formula to stdout.
89
+#
90
+generate_brew_formula()
91
+{
92
+#   local project="$1"
93
+#   local name="$2"
94
+#   local version="$3"
95
+#   local dependencies="$4"
96
+#   local builddependencies="$5"
97
+#   local homepage="$6"
98
+#   local desc="$7"
99
+#   local archiveurl="$8"
100
+
101
+   _generate_brew_formula "$@"
102
+}
103
+
104
+#######
105
+# Ideally changes to the following values are done with the command line
106
+# which makes it easier for forks.
107
+#######
108
+
109
+MULLE_BOOTSTRAP_FAIL_PREFIX="`basename -- $0`"
110
+MULLE_HOMEBREW_VERSION="3.4.5"
111
+
112
+EXEC_DIR="`dirname -- $0`"
113
+
114
+#
115
+# prefer local mulle-homebrew if available
116
+#
117
+if [ -x "${EXEC_DIR}/mulle-homebrew/mulle-homebrew-env" ]
118
+then
119
+   PATH="${EXEC_DIR}/mulle-homebrew:$PATH"
120
+fi
121
+
122
+if [ -z "`command -v mulle-homebrew-env`" ]
123
+then
124
+   echo "mulle-homebrew-env not found in PATH" >&2
125
+   exit 1
126
+fi
127
+
128
+
129
+INSTALLED_MULLE_HOMEBREW_VERSION="`mulle-homebrew-env version`" || exit 1
130
+LIBEXEC_DIR="`mulle-homebrew-env libexec-path`" || exit 1
131
+
132
+. "${LIBEXEC_DIR}/mulle-homebrew.sh" || exit 1
133
+. "${LIBEXEC_DIR}/mulle-git.sh"      || exit 1
134
+
135
+if ! homebrew_is_compatible_version "${INSTALLED_MULLE_HOMEBREW_VERSION}" "${MULLE_HOMEBREW_VERSION}"
136
+then
137
+   fail "Installed mulle-homebrew version ${INSTALLED_MULLE_HOMEBREW_VERSION} is \
138
+not compatible with this script from version ${MULLE_HOMEBREW_VERSION}"
139
+fi
140
+
23 141
 # parse options
24 142
 homebrew_parse_options "$@"
25 143
 
26
-# dial past options
144
+#
145
+# dial past options now as they have been parsed
146
+#
27 147
 while [ $# -ne 0 ]
28 148
 do
29 149
    case "$1" in
30 150
       -*)
31 151
          shift
32 152
       ;;
153
+
154
+      --*)
155
+         shift
156
+         shift
157
+      ;;
158
+
33 159
       *)
34 160
          break;
35 161
       ;;
36 162
    esac
37 163
 done
38 164
 
165
+# --- FORMULA GENERATION ---
166
+
167
+BOOTSTRAP_TAP="${BOOTSTRAP_TAP:-mulle-kybernetik/software/}"
168
+
169
+DEPENDENCY_TAP="${DEPENDENCY_TAP:-${PUBLISHER_TAP}}"
39 170
 
40 171
 #
41 172
 # these can usually be deduced, if you follow the conventions
42 173
 #
43
-NAME="`get_name_from_project "${PROJECT}" "${LANGUAGE}"`"
44
-HEADER="`get_header_from_name "${NAME}"`"
45
-VERSIONNAME="`get_versionname_from_project "${PROJECT}"`"
46
-VERSION="`get_header_version "${HEADER}" "${VERSIONNAME}"`"
174
+if [ -z "${NAME}" ]
175
+then
176
+   NAME="`get_name_from_project "${PROJECT}" "${LANGUAGE}"`"
177
+fi
47 178
 
48
-HOMEPAGE="`eval echo "${HOMEPAGE}"`"
179
+if [ -z "${VERSIONFILE}" ]
180
+then
181
+   VERSIONFILE="`get_header_from_name "${NAME}"`"
182
+fi
183
+
184
+if [ -z "${VERSIONNAME}" ]
185
+then
186
+   VERSIONNAME="`get_versionname_from_project "${PROJECT}"`"
187
+fi
188
+
189
+if [ -f VERSION ]
190
+then
191
+   VERSION="`head -1 VERSION`"
192
+else
193
+   VERSION="`get_project_version "${VERSIONFILE}" "${VERSIONNAME}"`"
194
+   if [ -z "${VERSION}" ]
195
+   then
196
+      VERSION="`get_project_version "src/version.h" "${VERSIONNAME}"`"
197
+   fi
198
+fi
199
+
200
+# where homebrew grabs the archive off
201
+ARCHIVE_URL="${ARCHIVE_URL:-https://github.com/${PUBLISHER}/${NAME}/archive/${VERSION}.tar.gz}"
202
+
203
+# written into formula for homebrew, will be evaled
204
+HOMEPAGE_URL="${HOMEPAGE_URL:-https://github.com/${PUBLISHER}/${NAME}}"
49 205
 
50 206
 
51 207
 # --- HOMEBREW TAP ---
52
-# Specify to where and under what bame to publish via your brew tap
208
+# Specify to where and under what name to publish via your brew tap
53 209
 #
54
-RBFILE="${NAME}.rb"                    # ruby file for brew
55
-HOMEBREWTAP="../homebrew-software"     # your tap repository path
210
+if [ -z "${PUBLISHER_TAP}" ]
211
+then
212
+   fail "you need to specify a publisher tap with --publisher-tap (hint: <mulle-kybernetik/software/>)"
213
+fi
56 214
 
215
+TAPS_LOCATION="${TAPS_LOCATION:-..}"
216
+
217
+HOMEBREW_TAP="${HOMEBREW_TAP:-${TAPS_LOCATION}/homebrew-`basename -- ${PUBLISHER_TAP}`}"
218
+
219
+RBFILE="${RBFILE:-${NAME}.rb}"
57 220
 
58 221
 # --- GIT ---
222
+
223
+#
224
+# require PUBLISHER (and PUBLISHER_TAP) as command line parameter, so
225
+# that forks don't have to edit this constantly
226
+#
227
+if [ -z "${PUBLISHER}" ]
228
+then
229
+   fail "You need to specify a publisher with --publisher (hint: https://github.com/<publisher>)"
230
+fi
231
+
232
+if [ -z "${VERSION}" ]
233
+then
234
+   fail "Could not figure out the version. (hint: check VERSIONNAME, VERSIONFILE)"
235
+fi
236
+
59 237
 # tag to tag your release
60
-# and the origin where
61
-TAG="${1:-${TAGPREFIX}${VERSION}}"
238
+TAG="${TAG:-${TAG_PREFIX}${VERSION}}"
239
+
240
+# git remote to push to, usually origin
241
+ORIGIN="${ORIGIN:-origin}"
242
+
243
+# git remote to push to, usually github, can be empty
244
+GITHUB="${GITHUB:-github}"
245
+
246
+# git branch to release to, source is always current
247
+BRANCH="${BRANCH:-release}"
62 248
 
63 249
 
64 250
 main()
65 251
 {
66
-   git_main "${ORIGIN}" "${TAG}" || exit 1
67
-   homebrew_main
252
+   # do the release
253
+   git_main "${BRANCH}" "${ORIGIN}" "${TAG}" "${GITHUB}" || exit 1
254
+
255
+   # generate the formula and push it
256
+   homebrew_main "${PROJECT}" \
257
+                 "${NAME}" \
258
+                 "${VERSION}" \
259
+                 "${DEPENDENCIES}" \
260
+                 "${BUILD_DEPENDENCIES}" \
261
+                 "${HOMEPAGE_URL}" \
262
+                 "${DESC}" \
263
+                 "${ARCHIVE_URL}" \
264
+                 "${HOMEBREW_TAP}" \
265
+                 "${RBFILE}"
68 266
 }
69 267
 
70 268
 main "$@"
... ...
@@ -14,7 +14,7 @@
14 14
 //
15 15
 // community version is always even
16 16
 //
17
-#define MULLE_VARARG_VERSION  ((0 << 20) | (5 << 8) | 13)
17
+#define MULLE_VARARG_VERSION  ((0 << 20) | (5 << 8) | 14)
18 18
 
19 19
 
20 20
 /*