Skip to content

Commit f80d75b

Browse files
committed
* modernize formula generation
1 parent 859db8b commit f80d75b

File tree

6 files changed

+101
-62
lines changed

6 files changed

+101
-62
lines changed

RELEASENOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 0.6.6
2+
3+
* modernize formula generation
4+
15
#### 0.6.5
26

37
* fix usage, update README.md

bin/formula-info.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# If you don't have this file, there will be no homebrew
33
# formula operations.
44
#
5-
PROJECT="mulle-xcode-to-cmake" # your project/repository name
6-
DESC="🎭 Convert Xcode projects to cmake CMakeLists.txt "
7-
LANGUAGE="objc" # c,cpp, objc, bash ...
8-
# NAME="${PROJECT}" # formula filename without .rb extension
5+
PROJECT="mulle-xcode-to-cmake" # your project/repository name
6+
DESC="mulle-xcode-to-cmake is ..."
7+
# LANGUAGE="c" # c,cpp, objc, bash ...
8+
# NAME="${PROJECT}" # formula filename without .rb extension
99

1010
#
1111
# Specify needed homebrew packages by name as you would when saying
@@ -24,6 +24,6 @@ LANGUAGE="objc" # c,cpp, objc, bash ...
2424
# edit bin/release.sh. Need to specify mulle-build dependencies
2525
# so that brew picks up the internal path!
2626
#
27-
#BUILD_DEPENDENCIES='${BOOTSTRAP_TAP}mulle-build
28-
#${BOOTSTRAP_TAP}mulle-bootstrap
29-
#' # cmake may be useful to add
27+
BUILD_DEPENDENCIES='${BOOTSTRAP_TAP}mulle-build
28+
${BOOTSTRAP_TAP}mulle-bootstrap
29+
' # cmake may be useful to add

bin/generate-formula.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# For documentation and help see:
3+
# https://github.com/mulle-nat/mulle-homebrew
4+
#
5+
#
6+
7+
#######
8+
# If you are using mulle-build, you don't hafta change anything
9+
#######
10+
11+
#
12+
# Generate your `def install` `test do` lines here. echo them to stdout.
13+
#
14+
generate_brew_formula_build()
15+
{
16+
local project="$1"
17+
local name="$2"
18+
local version="$3"
19+
20+
generate_brew_formula_mulle_build "${project}" "${name}" "${version}"
21+
generate_brew_formula_mulle_test "${project}" "${name}" "${version}"
22+
}
23+
24+
25+
#
26+
# If you are unhappy with the formula in general, then change
27+
# this function. Print your formula to stdout.
28+
#
29+
generate_brew_formula()
30+
{
31+
# local project="$1"
32+
# local name="$2"
33+
# local version="$3"
34+
# local dependencies="$4"
35+
# local builddependencies="$5"
36+
# local homepage="$6"
37+
# local desc="$7"
38+
# local archiveurl="$8"
39+
40+
_generate_brew_formula "$@"
41+
}
42+

bin/release.sh

Lines changed: 38 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env bash
22
#
3-
# Copyright (c) 2017 Nat! - Codeon GmbH
3+
# Copyright (c) 2017 Nat! - Mulle kybernetiK
44
# All rights reserved.
55
#
66
# Redistribution and use in source and binary forms, with or without
@@ -37,34 +37,8 @@
3737
# ./bin/release.sh -v -n --publisher mulle-nat --publisher-tap mulle-kybernetik/software/
3838
#
3939

40-
EXE_DIR="`dirname -- $0`"
41-
42-
# if there is a release-info.sh file read it
43-
if [ -f "${EXE_DIR}/release-info.sh" ]
44-
then
45-
DO_GIT_RELEASE="YES"
46-
. "${EXE_DIR}/release-info.sh"
47-
fi
48-
49-
# if there is a formula-info.sh file read it
50-
if [ -f "${EXE_DIR}/formula-info.sh" ]
51-
then
52-
DO_GENERATE_FORMULA="YES"
53-
. "${EXE_DIR}/formula-info.sh"
54-
fi
55-
56-
#
57-
# If there is a - possibly .gitignored - tap-info.sh file read it.
58-
# It could store PUBLISHER and PUBLISHER_TAP
59-
#
60-
if [ -f "${EXE_DIR}/tap-info.sh" ]
61-
then
62-
. "${EXE_DIR}/tap-info.sh"
63-
fi
64-
65-
6640
#######
67-
# If you are using mulle-build, you don't hafta change anything after this
41+
# If you are using mulle-build, you don't hafta change anything
6842
#######
6943

7044
#
@@ -76,15 +50,8 @@ generate_brew_formula_build()
7650
local name="$2"
7751
local version="$3"
7852

79-
cat <<EOF
80-
def install
81-
xcodebuild "install", "-target", "${project}", "DSTROOT=/", "INSTALL_PATH=#{bin}"
82-
end
83-
84-
test do
85-
system "#{bin}/${project}", "-version"
86-
end
87-
EOF
53+
generate_brew_formula_mulle_build "${project}" "${name}" "${version}"
54+
generate_brew_formula_mulle_test "${project}" "${name}" "${version}"
8855
}
8956

9057

@@ -106,18 +73,15 @@ generate_brew_formula()
10673
_generate_brew_formula "$@"
10774
}
10875

76+
10977
#######
11078
# Ideally changes to the following values are done with the command line
11179
# which makes it easier for forks.
11280
#######
11381

11482
MULLE_BOOTSTRAP_FAIL_PREFIX="`basename -- $0`"
115-
MULLE_HOMEBREW_VERSION="4.1.0"
83+
MULLE_HOMEBREW_VERSION="5.2.1"
11684

117-
#
118-
# prefer local mulle-homebrew if available
119-
# Do not embed it anymore!
120-
#
12185
if [ -z "`command -v mulle-homebrew-env`" ]
12286
then
12387
cat <<EOF >&2
@@ -131,6 +95,7 @@ fi
13195
INSTALLED_MULLE_HOMEBREW_VERSION="`mulle-homebrew-env version`" || exit 1
13296
LIBEXEC_DIR="`mulle-homebrew-env libexec-path`" || exit 1
13397

98+
. "${LIBEXEC_DIR}/mulle-files.sh" || exit 1
13499
. "${LIBEXEC_DIR}/mulle-homebrew.sh" || exit 1
135100
. "${LIBEXEC_DIR}/mulle-git.sh" || exit 1
136101
. "${LIBEXEC_DIR}/mulle-version.sh" || exit 1
@@ -141,7 +106,7 @@ main()
141106
{
142107
if [ "${DO_GIT_RELEASE}" != "YES" -a "${DO_GENERATE_FORMULA}" != "YES" ]
143108
then
144-
fail "Nothing to do. release-info.sh and formula-info.sh are missing"
109+
fail "Nothing to do! bin/version-info.sh and bin/formula-info.sh are missing"
145110
fi
146111

147112
if [ "${DO_GIT_RELEASE}" = "YES" ]
@@ -163,16 +128,36 @@ main()
163128
fi
164129

165130
# generate the formula and push it
166-
homebrew_main "${PROJECT}" \
167-
"${NAME}" \
168-
"${VERSION}" \
169-
"${DEPENDENCIES}" \
170-
"${BUILD_DEPENDENCIES}" \
171-
"${HOMEPAGE_URL}" \
172-
"${DESC}" \
173-
"${ARCHIVE_URL}" \
174-
"${HOMEBREW_TAP}" \
175-
"${RBFILE}"
131+
if ! homebrew_main "${PROJECT}" \
132+
"${NAME}" \
133+
"${VERSION}" \
134+
"${DEPENDENCIES}" \
135+
"${BUILD_DEPENDENCIES}" \
136+
"${HOMEPAGE_URL}" \
137+
"${DESC}" \
138+
"${ARCHIVE_URL}" \
139+
"${HOMEBREW_TAP}" \
140+
"${RBFILE}"
141+
then
142+
return 1
143+
fi
144+
fi
145+
146+
#
147+
# check if someone installed a post_release function
148+
# if yes call it (maybe calls mulle-homebrew-debian)
149+
#
150+
if [ "`type -t post_release`" = "function" ]
151+
then
152+
post_release "${PROJECT}" \
153+
"${NAME}" \
154+
"${VERSION}" \
155+
"${DEPENDENCIES}" \
156+
"${BUILD_DEPENDENCIES}" \
157+
"${HOMEPAGE_URL}" \
158+
"${DESC}" \
159+
"${ARCHIVE_URL}" \
160+
"${DEBIAN_DEPENDENCIES}"
176161
fi
177162
}
178163

bin/version-info.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -- Version Info --
2+
#
3+
# Keep these commented out, if the automatic detection works well
4+
# enough for you. If you don't have this file, there will be
5+
# not git operations.
6+
#
7+
# VERSIONFILE=
8+
# VERSIONNAME=

mulle-xcode-to-cmake.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@
369369
1DEB927908733DD40010E9CD /* Debug */ = {
370370
isa = XCBuildConfiguration;
371371
buildSettings = {
372-
CURRENT_PROJECT_VERSION = 0.6.5;
372+
CURRENT_PROJECT_VERSION = 0.6.6;
373373
DEBUG_INFORMATION_FORMAT = dwarf;
374374
DYLIB_COMPATIBILITY_VERSION = "$(CURRENT_PROJECT_VERSION)";
375375
DYLIB_CURRENT_VERSION = "${CURRENT_PROJECT_VERSION}";
@@ -390,7 +390,7 @@
390390
1DEB927A08733DD40010E9CD /* Release */ = {
391391
isa = XCBuildConfiguration;
392392
buildSettings = {
393-
CURRENT_PROJECT_VERSION = 0.6.5;
393+
CURRENT_PROJECT_VERSION = 0.6.6;
394394
DEBUG_INFORMATION_FORMAT = dwarf;
395395
DYLIB_COMPATIBILITY_VERSION = "$(CURRENT_PROJECT_VERSION)";
396396
DYLIB_CURRENT_VERSION = "${CURRENT_PROJECT_VERSION}";

0 commit comments

Comments
 (0)