Browse code

Use templates to create .md files where necessary

Nat! authored on 14-06-2017 15:37:44
Showing 10 changed files
... ...
@@ -4,6 +4,7 @@
4 4
 .repos/
5 5
 project.xcworkspace/
6 6
 *.old
7
+*.bak
7 8
 *.exe
8 9
 *.exe.debug
9 10
 *.exe.debug.dSYM
... ...
@@ -48,3 +49,4 @@ tests/vararg/pointer/longlong_pointer
48 49
 /tests/mulle-tests/
49 50
 /.bootstrap.repos
50 51
 /stashes
52
+bin/tap-info.sh
... ...
@@ -4,7 +4,7 @@ project (mulle-vararg)
4 4
 
5 5
 cmake_policy(SET CMP0054 NEW)
6 6
 
7
-set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/mulle-configuration)
7
+set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/mulle-configuration/cmake)
8 8
 message(STATUS "CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}")
9 9
 message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
10 10
 if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
... ...
@@ -1,3 +1,4 @@
1
+[comment]: <> (DO NOT EDIT THIS FILE. EDIT THE TEMPLATE "templates/README.md.scion")
1 2
 # mulle-vararg
2 3
 
3 4
 A variable argument passing scheme written in C (C11). It's an alternative
... ...
@@ -1,3 +1,3 @@
1
-PROJECT="MulleVararg"   # your project name, requires camel-case
1
+PROJECT="mulle-vararg"   # your project name, requires camel-case
2 2
 DESC="Access variable arguments in struct layout fashion"
3 3
 DEPENDENCIES='${DEPENDENCY_TAP}mulle-c11'
... ...
@@ -1,6 +1,6 @@
1 1
 #! /usr/bin/env bash
2 2
 #
3
-#   Copyright (c) 2017 Nat! - Codeon GmbH
3
+#   Copyright (c) 2017 Nat! - Mulle kybernetiK
4 4
 #   All rights reserved.
5 5
 #
6 6
 #   Redistribution and use in source and binary forms, with or without
... ...
@@ -53,6 +53,15 @@ then
53 53
    . "${EXE_DIR}/formula-info.sh"
54 54
 fi
55 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
+
56 65
 
57 66
 #######
58 67
 # If you are using mulle-build, you don't hafta change anything after this
... ...
@@ -96,7 +105,7 @@ generate_brew_formula()
96 105
 #######
97 106
 
98 107
 MULLE_BOOTSTRAP_FAIL_PREFIX="`basename -- $0`"
99
-MULLE_HOMEBREW_VERSION="4.0.0"
108
+MULLE_HOMEBREW_VERSION="4.1.0"
100 109
 
101 110
 #
102 111
 # prefer local mulle-homebrew if available
... ...
@@ -136,6 +145,16 @@ main()
136 145
 
137 146
    if [ "${DO_GENERATE_FORMULA}" = "YES" ]
138 147
    then
148
+      if [ -z "${PUBLISHER}" ]
149
+      then
150
+         fail "You need to specify a publisher with --publisher (hint: https://github.com/<publisher>)"
151
+      fi
152
+
153
+      if [ -z "${PUBLISHER_TAP}" ]
154
+      then
155
+         fail "You need to specify a publisher tap with --tap (hint: <mulle-kybernetik/software>)"
156
+      fi
157
+
139 158
       # generate the formula and push it
140 159
       homebrew_main "${PROJECT}" \
141 160
                     "${NAME}" \
... ...
@@ -1,3 +1,4 @@
1
+[comment]: <> (DO NOT EDIT THIS FILE. EDIT THE TEMPLATE "templates/dox/BUILD.md.scion")
1 2
 # How to build mulle-vararg
2 3
 
3 4
 
4 5
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+# Templates to support forks
2
+
3
+The templates in this directory structure were initially created with
4
+`mulle-objc-create-templates`.
5
+
6
+Recreate the original files from the templates with
7
+
8
+```
9
+mulle-objc-process-templates --publisher 'mulle-nat' --tap 'mulle-kybernetik/software'
10
+```
11
+
12
+or substitute with your own publisher information.
13
+
14
+---
15
+
16
+`mulle-objc-process-templates` and `mulle-objc-create-templates` are part of
17
+[mulle-objc-developer](https://github.com/mulle-objc/mulle-objc-developer)
0 18
new file mode 100644
... ...
@@ -0,0 +1,107 @@
1
+# mulle-vararg
2
+
3
+A variable argument passing scheme written in C (C11). It's an alternative
4
+to
5
+[stdarg](//en.wikipedia.org/wiki/Stdarg.h) or
6
+[varargs](//pubs.opengroup.org/onlinepubs/7908799/xsh/varargs.h.html),
7
+but not compatible with either.
8
+
9
+
10
+Fork      |  Build Status | Release Version
11
+----------|---------------|-----------------------------------
12
+{% if PUBLISHER != "mulle-objc" %}
13
+[{{PUBLISHER_FULLNAME}}](//github.com/{{PUBLISHER}}/mulle-vararg) | [![Build Status](https://travis-ci.org/{{PUBLISHER}}/mulle-vararg.svg?branch=release)](https://travis-ci.org/{{PUBLISHER}}/mulle-vararg) | ![{{PUBLISHER_FULLNAME}} tag](https://img.shields.io/github/tag/{{PUBLISHER}}/mulle-vararg.svg) [![Build Status](https://travis-ci.org/{{PUBLISHER}}/mulle-vararg.svg?branch=release)](https://travis-ci.org/{{PUBLISHER}}/mulle-vararg)
14
+{% endif %}
15
+[Community](https://github.com/mulle-objc/mulle-vararg/tree/release) | [![Build Status](https://travis-ci.org/mulle-objc/mulle-vararg.svg)](https://travis-ci.org/mulle-objc/mulle-vararg) | ![Community tag](https://img.shields.io/github/tag/mulle-objc/mulle-vararg.svg) [![Build Status](https://travis-ci.org/mulle-objc/mulle-vararg.svg?branch=release)](https://travis-ci.org/mulle-objc/mulle-vararg)
16
+
17
+
18
+#### Advantages
19
+
20
+* Easy to write in C, does not need compiler ABI internals to construct or
21
+read. You don't need [libffi](//sourceware.org/libffi/) or some such.
22
+* Cheap forwarding to other functions.
23
+
24
+
25
+#### Disadvantages
26
+
27
+* Not compatible with `<stdarg.h>`
28
+
29
+
30
+## How it works
31
+
32
+**mulle-vararg** assumes that the arguments are not layed out in stack
33
+alignment fashion but like in a struct. The C promotion rules are still
34
+observed though.
35
+
36
+> Remember the C argument promotion rules are
37
+>
38
+> 1. char and short to int/unsigned int
39
+> 2. float to double
40
+>
41
+
42
+Let's assume there is a compiler that uses **mulle-vararg** for variable
43
+arguments. It collects **all** function parameters and packs them into a struct,
44
+then passes this struct to the function.
45
+
46
+A **printf** function being being called like this:
47
+
48
+```
49
+printf( "%d %f %lld\n", (char) 'x', (float) 0.2, 1848LL;
50
+```
51
+
52
+would get its arguments embedded in a struct like this
53
+
54
+```
55
+struct
56
+{
57
+   char    *format;
58
+   struct
59
+   {
60
+      int         value1;     // standard char -> int promotion
61
+      double      value2;     // standard float -> double promotion
62
+      long long   value3;
63
+   } varargs;
64
+} _param;
65
+```
66
+
67
+**mulle-vararg** provides the necessary functions to read such a struct. It has
68
+no code to create it.
69
+
70
+
71
+## API
72
+
73
+* [Vararg](dox/API_VARARG.md)
74
+
75
+
76
+## Install
77
+
78
+On OS X and Linux you can use [homebrew](//brew.sh), respectively
79
+[linuxbrew](//linuxbrew.sh) to install the library:
80
+
81
+```
82
+brew install mulle-objc/software/mulle-vararg
83
+```
84
+
85
+On other platforms you can use **mulle-install** from
86
+[mulle-build](//github.com/{{PUBLISHER}}/mulle-build) to install the library:
87
+
88
+```
89
+mulle-install --prefix /usr/local --branch release https://github.com/mulle-objc/mulle-vararg
90
+```
91
+
92
+Otherwise read:
93
+
94
+* [How to Build](dox/BUILD.md)
95
+
96
+
97
+### Platforms and Compilers
98
+
99
+All platforms and compilers supported by
100
+[mulle-c11](//www.mulle-kybernetik.com/software/git/mulle-c11/)
101
+
102
+## Author
103
+
104
+[Nat!](//www.mulle-kybernetik.com/weblog) for
105
+[Mulle kybernetiK](//www.mulle-kybernetik.com) and
106
+[Codeon GmbH](//www.codeon.de)
107
+
0 108
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+[comment]: <> ({{COMMENT}})
2
+{% includes TEMPLATE_FILE %}
0 3
new file mode 100644
... ...
@@ -0,0 +1,99 @@
1
+# How to build mulle-vararg
2
+
3
+
4
+## What you get
5
+
6
+* `libmulle_vararg.a` the mulle-vararg static library along with a bunch of
7
+headers.
8
+
9
+
10
+## Prerequisites
11
+
12
+#### mulle-c11
13
+
14
+[mulle-c11](//www.mulle-kybernetik.com/software/git/mulle-c11/) is a header
15
+that abstracts a small set of non-standardized compiler features.
16
+
17
+#### mulle-configuration
18
+
19
+[mulle-configuration](//www.mulle-kybernetik.com/software/git/mulle-configuration/)
20
+are configuration files for building with Xcode or cmake. This is expected to
21
+exist in the project directory root.
22
+
23
+
24
+## Nice to have
25
+
26
+#### mulle-build
27
+
28
+[mulle-build](//www.mulle-kybernetik.com/software/git/mulle-build) is used
29
+to assemble the dependencies together and build the library.
30
+
31
+#### mulle-homebrew
32
+
33
+[mulle-homebrew](//www.mulle-kybernetik.com/software/git/mulle-homebrew/) is
34
+support for generating homebrew formulae. This is expected to
35
+exist in `./bin`, if you want to release a fork.
36
+
37
+#### mulle-tests
38
+
39
+[mulle-tests](//www.mulle-kybernetik.com/software/git/mulle-tests/) are
40
+scripts to provide an environment for running the tests. This is expected to
41
+exist in `./tests`, if you want to run tests.
42
+
43
+
44
+### Windows: Installing further prerequisites
45
+
46
+Check the [mulle-build README.md](//www.mulle-kybernetik.com/software/git/mulle-build/README.md)
47
+for instrutions how to get the "Git for Windows" bash going.
48
+
49
+
50
+### OSX: Install mulle-build using homebrew
51
+
52
+Install the [homebrew](//brew.sh/) package manager, then
53
+
54
+```
55
+brew tap {{PUBLISHER_TAP}}
56
+brew install mulle-build
57
+```
58
+
59
+### Linux: Install mulle-build using linuxbrew
60
+
61
+Install the [linuxbrew](//linuxbrew.sh/) package manager, then
62
+
63
+```
64
+brew tap {{PUBLISHER_TAP}}
65
+brew install mulle-build
66
+```
67
+
68
+### All: Install mulle-build using git
69
+
70
+```
71
+git clone https://github.com/{{PUBLISHER}}/mulle-bootstrap
72
+( cd mulle-bootstrap ; ./install.sh )
73
+git clone https://github.com/{{PUBLISHER}}/mulle-build
74
+( cd mulle-build ; ./install.sh )
75
+```
76
+
77
+## All: Install mulle-vararg using mulle-build
78
+
79
+
80
+Grab the latest **mulle-vararg** release and go into the project directory:
81
+
82
+```
83
+git clone https://github.com/mulle-objc/mulle-vararg
84
+cd mulle-vararg
85
+```
86
+
87
+Then let **mulle-build** fetch the dependencies and build **mulle-vararg** in
88
+debug mode:
89
+
90
+```
91
+mulle-build --debug
92
+```
93
+
94
+Build library in release mode and install into `tmp` :
95
+
96
+```
97
+mulle-clean ;
98
+mulle-install --prefix /tmp
99
+```