Browse code

* migration from bootstrap to mulle-sde

Nat! authored on 09-07-2018 19:30:09
Showing 307 changed files
1 1
deleted file mode 100644
... ...
@@ -1,2 +0,0 @@
1
-${MULLE_REPOSITORIES:-https://github.com/mulle-nat}/mulle-configuration;;${MULLE_CONFIGURATION_BRANCH:-release}
2
-${MULLE_REPOSITORIES:-https://github.com/mulle-nat}/google-toolbox-for-mac
3 0
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-https://github.com/madler/zlib.git
... ...
@@ -23,10 +23,50 @@ dependencies/
23 23
 dox/html/
24 24
 github*.json
25 25
 google-toolbox-for-mac/
26
-mulle-configuration/
26
+mulle-sde-xcconfig/
27 27
 project.xcworkspace/
28
-tests/bin/
29
-tests/compare-parse-speed-to-unarchive-speed.sh
30
-tests/include/
31
-tests/lib/
28
+test/bin/
29
+test/compare-parse-speed-to-unarchive-speed.sh
30
+test/include/
31
+test/lib/
32 32
 xcuserdata/
33
+.gitignore
34
+
35
+# ### > generated by mulle-sde (extensions/mulle-sde/sde/init)
36
+
37
+# generally /var and directories are not interesting
38
+.mulle-*/var/
39
+
40
+# .mulle-env /bin and /libexec are not interesting
41
+
42
+.mulle-env/bin/
43
+.mulle-env/libexec/
44
+
45
+# env/style is "fluctuating" on a per-user level so not interesting
46
+.mulle-env/env/style
47
+
48
+# per user/ per host tweaks are probably not interesting in the repository
49
+
50
+.mulle-env/share/environment-user-*.sh
51
+.mulle-env/share/environment-host-*.sh
52
+
53
+# .mulle-sde is generally interesting
54
+
55
+# dynamically .mulle-sourcetree-fix is boring
56
+.mulle-sourcetree-fix
57
+
58
+# stash is generally boring
59
+stash/
60
+
61
+# build stuff is boring too
62
+build/
63
+dependency/
64
+addiction/
65
+*.tmp/
66
+tmp.*/
67
+
68
+# ### < generated by mulle-sde (extensions/mulle-sde/sde/init)
69
+
70
+.mulle-env/etc/environment-user-*.sh
71
+mulle-sde-xcconfig
72
+mulle-sde-xcconfig/
33 73
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+#
2
+#
3
+#
4
+export MULLE_SDE_UPDATE_CALLBACKS="sourcetree"
5
+
6
+
0 7
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+mulle/wild
0 2
new file mode 100644
... ...
@@ -0,0 +1,46 @@
1
+#
2
+# Git mirror and Zip/TGZ cache to conserve bandwidth
3
+# Memo: override in os-specific env file
4
+#
5
+export MULLE_FETCH_MIRROR_DIR="${HOME:-/tmp}/.cache/mulle-fetch/git-mirror"
6
+
7
+#
8
+# Git mirror and Zip/TGZ cache to conserve bandwidth
9
+#
10
+export MULLE_FETCH_ARCHIVE_DIR="${HOME:-/tmp}/.cache/mulle-fetch/archive"
11
+
12
+#
13
+# PATH to search for git repositories locally
14
+#
15
+export MULLE_FETCH_SEARCH_PATH="${MULLE_VIRTUAL_ROOT}/.."
16
+
17
+#
18
+# Prefer symlinking to local git repositories found via MULLE_FETCH_SEARCH_PATH
19
+#
20
+export MULLE_SOURCETREE_SYMLINK="YES"
21
+
22
+#
23
+# Use common folder for sharable projects
24
+#
25
+export MULLE_SOURCETREE_SHARE_DIR="${MULLE_VIRTUAL_ROOT}/stash"
26
+
27
+#
28
+# Share dependency directory (absolute for ease of use)
29
+#
30
+export DEPENDENCY_DIR="${MULLE_VIRTUAL_ROOT}/dependency"
31
+
32
+#
33
+# Share addiction directory (absolute for ease of use)
34
+#
35
+export ADDICTION_DIR="${MULLE_VIRTUAL_ROOT}/addiction"
36
+
37
+#
38
+# Use common build directory
39
+#
40
+export BUILD_DIR="${MULLE_VIRTUAL_ROOT}/build"
41
+
42
+#
43
+# Modify path so that dependency and addictions executables are found and
44
+# preferred.
45
+#
46
+export PATH="${DEPENDENCY_DIR}/bin:${ADDICTION_DIR}/bin:$PATH"
0 47
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+#
2
+# Git mirror and Zip/TGZ cache to conserve bandwidth
3
+#
4
+export MULLE_FETCH_MIRROR_DIR="${HOME:-/tmp}/Library/Caches/mulle-fetch/git-mirror"
5
+export MULLE_FETCH_ARCHIVE_DIR="${HOME:-/tmp}/Library/Caches/mulle-fetch/archive"
0 6
new file mode 100644
... ...
@@ -0,0 +1,36 @@
1
+#
2
+#
3
+#
4
+export PROJECT_NAME="MulleScion"
5
+
6
+
7
+#
8
+#
9
+#
10
+export PROJECT_TYPE="library"
11
+
12
+
13
+#
14
+#
15
+#
16
+export PROJECT_SOURCE_DIR="src"
17
+
18
+
19
+#
20
+#
21
+#
22
+export PROJECT_LANGUAGE="c"
23
+
24
+
25
+#
26
+#
27
+#
28
+export PROJECT_DIALECT="objc"
29
+
30
+
31
+#
32
+#
33
+#
34
+export PROJECT_EXTENSIONS="m:aam"
35
+
36
+
0 37
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+# Used by `mulle-match find` to speed up the search.
2
+export MULLE_MATCH_FIND_NAMES="config:*.h:*.inc:*.c:CMakeLists.txt:*.cmake:*.m:*.aam"
3
+
4
+
5
+# Used by `mulle-match find` to locate files
6
+export MULLE_MATCH_FIND_LOCATIONS="${PROJECT_SOURCE_DIR}:CMakeLists.txt:cmake"
7
+
8
+
9
+# By default assume a project has source and a sourcetree in that order.
10
+
11
+
12
+#
13
+#
14
+#
15
+export MULLE_SDE_INSTALLED_VERSION="0.26.0"
16
+
17
+
18
+# By default assume a project has source and a sourcetree in that order.
19
+
20
+
21
+# By default assume a project has source and a sourcetree in that order.
22
+
23
+
24
+# By default assume a project has source and a sourcetree in that order.
25
+
26
+
27
+# By default assume a project has source and a sourcetree in that order.
28
+
29
+
30
+# By default assume a project has source and a sourcetree in that order.
31
+
32
+
33
+# By default assume a project has source and a sourcetree in that order.
34
+
35
+
36
+# By default assume a project has source and a sourcetree in that order.
37
+
38
+
39
+# By default assume a project has source and a sourcetree in that order.
40
+
41
+
42
+# By default assume a project has source and a sourcetree in that order.
43
+
44
+
45
+# By default assume a project has source and a sourcetree in that order.
46
+
47
+
48
+# By default assume a project has source and a sourcetree in that order.
49
+export MULLE_SDE_UPDATE_CALLBACKS="sourcetree:source"
50
+
51
+
0 52
new file mode 100644
... ...
@@ -0,0 +1,102 @@
1
+[ "${TRACE}" = "YES" -o "${MULLE_ENVIRONMENT_TRACE}" = "YES" ] && set -x  && : "$0" "$@"
2
+
3
+#
4
+# If mulle-env is broken, sometimes its nice just to source this file.
5
+# If you're sourcing this manually on a regular basis, you're doing it wrong.
6
+#
7
+# We need some minimal stuff to get things going though:
8
+#     sed, cut, tr, hostname, pwd, uname
9
+#
10
+if [ -z "${MULLE_UNAME}" ]
11
+then
12
+   MULLE_UNAME="`PATH=/bin:/usr/bin uname | \
13
+                  PATH=/bin:/usr/bin cut -d_ -f1 | \
14
+                  PATH=/bin:/usr/bin sed 's/64$//' | \
15
+                  PATH=/bin:/usr/bin tr 'A-Z' 'a-z'`"
16
+   export MULLE_UNAME
17
+fi
18
+if [ -z "${MULLE_VIRTUAL_ROOT}" ]
19
+then
20
+   MULLE_VIRTUAL_ROOT="`PATH=/bin:/usr/bin pwd -P`"
21
+   echo "Using ${MULLE_VIRTUAL_ROOT} as MULLE_VIRTUAL_ROOT for \
22
+your convenience" >&2
23
+fi
24
+
25
+alias mulle-env-reload='. "${MULLE_VIRTUAL_ROOT}/.mulle-env/share/include-environment.sh"'
26
+
27
+case "${MULLE_SHELL_MODE}" in
28
+   *INTERACTIVE*)
29
+      #
30
+      # Set PS1 so that we can see, that we are in a mulle-env
31
+      #
32
+      envname="`PATH=/bin:/usr/bin basename -- "${MULLE_VIRTUAL_ROOT}"`"
33
+
34
+      case "${PS1}" in
35
+         *\\h\[*)
36
+         ;;
37
+
38
+         *\\h*)
39
+            PS1="$(sed 's/\\h/\\h\['${envname}'\]/' <<< '${PS1}' )"
40
+         ;;
41
+
42
+         *)
43
+            PS1='\u@\h['${envname}'] \W$ '
44
+         ;;
45
+      esac
46
+      export PS1
47
+
48
+      unset envname
49
+
50
+      # install cd catcher
51
+      . "${MULLE_ENV_LIBEXEC_DIR}/mulle-env-cd.sh"
52
+      unset MULLE_ENV_LIBEXEC_DIR
53
+
54
+      mulle-env-reload
55
+   ;;
56
+
57
+   *)
58
+      set -a ; mulle-env-reload     # export all definitions for command
59
+      eval ${COMMAND}  # must eval this so ls -1 ${MULLE_VIRTUAL_ROOT} works
60
+      exit $?
61
+   ;;
62
+esac
63
+
64
+
65
+#
66
+# Source in bash completion if available
67
+# Assumed is, that they are not user modifiable
68
+#
69
+case "${MULLE_SHELL_MODE}" in
70
+   *INTERACTIVE*)
71
+      DEFAULT_IFS="${IFS}"
72
+      shopt -s nullglob; IFS="
73
+"
74
+      for FILENAME in "${MULLE_VIRTUAL_ROOT}/.mulle-env/share/libexec"/*-bash-completion.sh
75
+      do
76
+         . "${FILENAME}"
77
+      done
78
+      shopt -u nullglob; IFS="${DEFAULT_IFS}"
79
+
80
+      unset FILENAME
81
+      unset DEFAULT_IFS
82
+   ;;
83
+esac
84
+
85
+#
86
+#
87
+# show motd, if any
88
+#
89
+if [ -z "${NO_MOTD}" ]
90
+then
91
+   if [ -f "${MULLE_VIRTUAL_ROOT}/.mulle-env/etc/motd" ]
92
+   then
93
+      cat "${MULLE_VIRTUAL_ROOT}/.mulle-env/etc/motd"
94
+   else
95
+      if [ -f "${MULLE_VIRTUAL_ROOT}/.mulle-env/share/motd" ]
96
+      then
97
+         cat "${MULLE_VIRTUAL_ROOT}/.mulle-env/share/motd"
98
+      fi
99
+   fi
100
+else
101
+   unset NO_MOTD
102
+fi
0 103
new file mode 100644
... ...
@@ -0,0 +1,101 @@
1
+[ "${TRACE}" = "YES" ] && set -x  && : "$0" "$@"
2
+
3
+[ -z "${MULLE_VIRTUAL_ROOT}" -o -z "${MULLE_UNAME}"  ] && \
4
+   echo "Your script needs to setup MULLE_VIRTUAL_ROOT \
5
+and MULLE_UNAME properly" >&2  && exit 1
6
+
7
+MULLE_HOSTNAME="`PATH=/bin:/usr/bin hostname -s`" # don't export it
8
+
9
+MULLE_ENV_SHARE_DIR="${MULLE_VIRTUAL_ROOT}/.mulle-env/share"
10
+MULLE_ENV_ETC_DIR="${MULLE_VIRTUAL_ROOT}/.mulle-env/etc"
11
+
12
+
13
+# Top/down order of inclusion.
14
+# Left overrides right if present.
15
+#
16
+# .mulle-env/etc                        | .mulle-env/share
17
+# --------------------------------------|--------------------
18
+#                                       | environment-aux.sh
19
+#                                       | environment-project.sh
20
+#                                       | environment-share.sh
21
+# environment-global.sh                 |
22
+# environment-os-${MULLE_UNAME}.sh      | environment-os-${MULLE_UNAME}.sh
23
+# environment-host-${MULLE_HOSTNAME}.sh |
24
+# environment-user-${USER}.sh           |
25
+# custom-environment.sh                 |
26
+#
27
+
28
+#
29
+# The aux file, if present is to be set by a mulle-env plugin
30
+#
31
+if [ -f "${MULLE_ENV_SHARE_DIR}/environment-aux.sh" ]
32
+then
33
+   . "${MULLE_ENV_SHARE_DIR}/environment-aux.sh"
34
+fi
35
+
36
+
37
+#
38
+# The project file, if present is to be set by mulle-sde init itself
39
+# w/o extensions
40
+#
41
+if [ -f "${MULLE_ENV_SHARE_DIR}/environment-project.sh" ]
42
+then
43
+   . "${MULLE_ENV_SHARE_DIR}/environment-project.sh"
44
+fi
45
+
46
+#
47
+# The share file, if present is to be set by mulle-sde extensions.
48
+#
49
+if [ -f "${MULLE_ENV_SHARE_DIR}/environment-share.sh" ]
50
+then
51
+   . "${MULLE_ENV_SHARE_DIR}/environment-share.sh"
52
+fi
53
+
54
+
55
+if [ -f "${MULLE_ENV_ETC_DIR}/environment-global.sh" ]
56
+then
57
+   . "${MULLE_ENV_ETC_DIR}/environment-global.sh"
58
+fi
59
+
60
+#
61
+# "os-" can be written by extensions also
62
+#
63
+if [ -f "${MULLE_ENV_ETC_DIR}/environment-os-${MULLE_UNAME}.sh" ]
64
+then
65
+   . "${MULLE_ENV_ETC_DIR}/environment-os-${MULLE_UNAME}.sh"
66
+else
67
+   if [ -f "${MULLE_ENV_SHARE_DIR}/environment-os-${MULLE_UNAME}.sh" ]
68
+   then
69
+      . "${MULLE_ENV_SHARE_DIR}/environment-os-${MULLE_UNAME}.sh"
70
+   fi
71
+fi
72
+
73
+#
74
+# Load in some modifications depending on hostname, username. These
75
+# won't be provided by extensions or plugins.
76
+#
77
+# These settings could be "cased" in a single file, but it seems convenient.
78
+# And more managable for mulle-env environment
79
+#
80
+
81
+if [ -f "${MULLE_ENV_ETC_DIR}/environment-host-${MULLE_HOSTNAME}.sh" ]
82
+then
83
+   . "${MULLE_ENV_ETC_DIR}/environment-host-${MULLE_HOSTNAME}.sh"
84
+fi
85
+
86
+if [ -f "${MULLE_ENV_ETC_DIR}/environment-user-${USER}.sh" ]
87
+then
88
+   . "${MULLE_ENV_ETC_DIR}/environment-user-${USER}.sh"
89
+fi
90
+
91
+#
92
+# For more complex edits, that don't work with the cmdline tool
93
+#
94
+if [ -f "${MULLE_ENV_ETC_DIR}/custom-environment.sh" ]
95
+then
96
+   . "${MULLE_ENV_ETC_DIR}/custom-environment.sh"
97
+fi
98
+
99
+unset MULLE_ENV_ETC_DIR
100
+unset MULLE_ENV_SHARE_DIR
101
+unset MULLE_HOSTNAME
0 102
new file mode 100644
... ...
@@ -0,0 +1,168 @@
1
+#! /usr/bin/env bash
2
+#
3
+#   Copyright (c) 2018 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
5
+#
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
+[ "${TRACE}" = "YES" ] && set -x && : "$0" "$@"
33
+
34
+
35
+_mulle_env_style_complete()
36
+{
37
+   local cur=${COMP_WORDS[COMP_CWORD]}
38
+
39
+   local toolstyles
40
+   local envstyles
41
+
42
+   toolstyles="${1:-`mulle-env toolstyles`}"
43
+   envstyles="`mulle-env envstyles`"
44
+
45
+   local ts
46
+   local es
47
+   local allstyles
48
+
49
+   for ts in ${toolstyles}
50
+   do
51
+      for es in ${envstyles}
52
+      do
53
+         allstyles="${allstyles} ${ts}/${es}"
54
+      done
55
+   done
56
+
57
+   COMPREPLY=( $( compgen -W "${allstyles}" -- "$cur" ) )
58
+}
59
+
60
+
61
+_mulle_env_complete()
62
+{
63
+   local cur=${COMP_WORDS[COMP_CWORD]}
64
+   local prev=${COMP_WORDS[COMP_CWORD-1]}
65
+
66
+   local list
67
+   local i
68
+   local context
69
+
70
+   for i in "${COMP_WORDS[@]}"
71
+   do
72
+      case "$i" in
73
+         environment|init|style|subenv|tool)
74
+            context="$i"
75
+         ;;
76
+      esac
77
+   done
78
+
79
+   case "${context}" in
80
+      tool)
81
+         case "$prev" in
82
+            remove)
83
+               list="`mulle-env -e tool list`"
84
+               COMPREPLY=( $( compgen -W "${list}" -- "$cur" ) )
85
+            ;;
86
+
87
+            list)
88
+            ;;
89
+
90
+            add)
91
+            ;;
92
+
93
+            *)
94
+               COMPREPLY=( $( compgen -W "add remove list}" -- "$cur" ) )
95
+            ;;
96
+         esac
97
+      ;;
98
+
99
+      environment)
100
+         case "$prev" in
101
+            get|set)
102
+               list="`mulle-env -s environment list | sed 's/^\([^=]*\).*/\1/'`"
103
+               COMPREPLY=( $( compgen -W "${list}" -- "$cur" ) )
104
+            ;;
105
+
106
+            list)
107
+            ;;
108
+
109
+            --scope)
110
+               list="`mulle-env -s environment scopes`"
111
+               COMPREPLY=( $( compgen -W "${list}" -- "$cur" ) )
112
+            ;;
113
+
114
+            *)
115
+               case "${cur}" in
116
+                  -*)
117
+                     COMPREPLY=( $( compgen -W "--global --hostname --os --scope --user" -- "$cur" ) )
118
+                  ;;
119
+
120
+                  *)
121
+                     COMPREPLY=( $( compgen -W "get list set scopes" -- "$cur" ) )
122
+                  ;;
123
+               esac
124
+            ;;
125
+         esac
126
+      ;;
127
+
128
+      subenv)
129
+         COMPREPLY=( $( compgen -d -- "$cur" ) )
130
+      ;;
131
+
132
+      style)
133
+         _mulle_env_style_complete
134
+      ;;
135
+
136
+      *)
137
+         case "$prev" in
138
+            -s|--style)
139
+               _mulle_env_style_complete
140
+            ;;
141
+
142
+            -d|--directory)
143
+               COMPREPLY=( $( compgen -d -- "$cur" ) )
144
+            ;;
145
+
146
+            *)
147
+               case "$cur" in
148
+                  -*)
149
+                     COMPREPLY=( $( compgen -W "--style --directory" -- "$cur" ) )
150
+                  ;;
151
+
152
+                  *)
153
+                     if [ "${context}" = "init" ]
154
+                     then
155
+                        COMPREPLY=( $( compgen -d -- "$cur" ) )
156
+                     else
157
+                        COMPREPLY=( $( compgen -W "environment init subenv style tool" -- $cur ) )
158
+                     fi
159
+                  ;;
160
+               esac
161
+            ;;
162
+         esac
163
+      ;;
164
+   esac
165
+}
166
+
167
+complete -F _mulle_env_complete mulle-env
168
+
0 169
new file mode 100644
... ...
@@ -0,0 +1,10 @@
1
+#! /usr/bin/env bash
2
+
3
+#
4
+# install completion if not yet present.
5
+# mulle-sde-bash-completion.sh will load the inferior completes
6
+#
7
+if [ "`type -t "_mulle_sde_complete"`" != "function" ]
8
+then
9
+   . "$(mulle-sde libexec-dir)/mulle-sde-bash-completion.sh"
10
+fi
0 11
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+Ready to build with:
2
+   mulle-sde craft
0 3
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+
2
+otool
3
+install_name_tool
4
+xcrun
5
+xcodebuild
6
+inotifywait
7
+ssh
8
+cc
9
+gcc
10
+ld
11
+ninja
0 12
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+mulle/wild
0 2
new file mode 100644
... ...
@@ -0,0 +1,70 @@
1
+mudo
2
+
3
+cat
4
+chgrp
5
+chmod
6
+chown
7
+cp
8
+date
9
+dd
10
+df
11
+dmesg
12
+echo
13
+false
14
+hostname
15
+kill
16
+ln
17
+login
18
+ls
19
+mkdir
20
+mknod
21
+more
22
+mount
23
+mv
24
+ps
25
+pwd
26
+rm
27
+rmdir
28
+sed
29
+sh
30
+stty
31
+su
32
+sync
33
+true
34
+umount
35
+uname
36
+
37
+awk
38
+basename
39
+base64
40
+bash
41
+clear
42
+command
43
+cut
44
+dirname
45
+ed
46
+egrep
47
+env
48
+expr
49
+find
50
+fgrep
51
+grep
52
+head
53
+less
54
+more
55
+readlink
56
+sleep
57
+sort
58
+stat
59
+tail
60
+test
61
+tr
62
+vi
63
+wc
64
+which
65
+curl
66
+column
67
+git
68
+uuidgen
69
+cmake
70
+make
0 71
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+0.15.4
0 2
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+mulle-clang
0 2
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+mulle-clang
0 2
new file mode 100755
... ...
@@ -0,0 +1,622 @@
1
+#! /usr/bin/env bash
2
+#
3
+#   Copyright (c) 2018 Nat! - Mulle kybernetiK
4
+#   All rights reserved.
5
+#
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
+[ "${TRACE}" = "YES" ] && set -x && : "$0" "$@"
34
+
35
+
36
+usage()
37
+{
38
+   cat <<EOF >&2
39
+Usage:
40
+   c-sourcetree-update <action> <filename> <category>
41
+
42
+   Produces the _<project>-include.h files and related headers.
43
+
44
+EOF
45
+   exit 1
46
+}
47
+
48
+
49
+uname_to_cpp()
50
+{
51
+   log_entry "uname_to_cmake" "$@"
52
+
53
+   local uname="$1"  # the part after only-os or no
54
+
55
+   case "${uname}" in
56
+      "darwin")
57
+         echo "__APPLE__"
58
+      ;;
59
+
60
+      "freebsd")
61
+         echo "BSD4_3"  # guess
62
+      ;;
63
+
64
+      *)
65
+         echo "__${uname}__"
66
+      ;;
67
+   esac
68
+}
69
+
70
+
71
+osexclude_to_cpp_if()
72
+{
73
+   log_entry "osexclude_to_cpp_if" "$@"
74
+
75
+   local marks="$1"
76
+
77
+   local cppvar
78
+
79
+   local excludes
80
+   local onlys
81
+
82
+   set -o noglob ; IFS=","
83
+
84
+   for osexclude in ${marks}
85
+   do
86
+      IFS="${DEFAULT_IFS}"; set +o noglob
87
+
88
+      case "${osexclude}" in
89
+         only-os-*)
90
+            cppvar="`uname_to_cpp "${osexclude:8}"`"
91
+            onlys="`concat "${onlys}" "defined( ${cppvar})" " || " `"
92
+         ;;
93
+
94
+         no-os-*)
95
+            cppvar="`uname_to_cpp "${osexclude:6}"`"
96
+            excludes="`concat "${excludes}" "! defined( ${cppvar})" " && "`"
97
+         ;;
98
+      esac
99
+   done
100
+   IFS="${DEFAULT_IFS}"; set +o noglob
101
+
102
+   if [ ! -z "${onlys}" ]
103
+   then
104
+      echo "# if ${onlys}"
105
+      return
106
+   fi
107
+
108
+   if [ ! -z "${excludes}" ]
109
+   then
110
+      echo "# if ${excludes}"
111
+   fi
112
+}
113
+
114
+
115
+_emit_c_include()
116
+{
117
+   log_entry "_emit_c_include" "$@"
118
+
119
+   local address="$1"
120
+   local header="$2"
121
+   local marks="$3"
122
+
123
+   local indent
124
+   local ifstatement
125
+   local include
126
+   local mark
127
+
128
+   #
129
+   # so objc can reuse this, make a provision for import with --objc flag
130
+   # but allow #include if the mark no-objc is set
131
+   #
132
+   include="include"
133
+   if [ "${OPTION_IMPORT}" = "YES" ]
134
+   then
135
+      include="import"
136
+
137
+      case ",${marks}," in
138
+         *,no-import,*)
139
+            include="include"
140
+         ;;
141
+      esac
142
+   fi
143
+
144
+   if [ ! -z "${marks}" ]
145
+   then
146
+      ifstatement="`osexclude_to_cpp_if "${marks}" `"
147
+   fi
148
+
149
+   if [ ! -z "${ifstatement}" ]
150
+   then
151
+      echo "${ifstatement}"
152
+      indent=" "
153
+   fi
154
+
155
+   # TODO: remove support __has_include for C ? Not all C compilers have
156
+   #       __has_include
157
+   case ",${marks}," in
158
+      *,no-require,*)
159
+         echo "# if __has_include(<${header}>)"
160
+         echo "#  ${indent}${include} <${header}>   // ${address}"
161
+         echo "# endif"
162
+      ;;
163
+
164
+      *)
165
+         echo "# ${indent}${include} <${header}>   // ${address}"
166
+      ;;
167
+   esac
168
+
169
+
170
+   if [ ! -z "${ifstatement}" ]
171
+   then
172
+      echo "# endif"
173
+   fi
174
+
175
+   echo
176
+}
177
+
178
+
179
+emit_c_include_library()
180
+{
181
+   log_entry "emit_c_include_library" "$@"
182
+
183
+   local address="$1"
184
+   local marks="$2"
185
+   local header="$3"
186
+
187
+   #
188
+   # the default for libraries is old style <name.h> not <name/name.h>
189
+   #
190
+   if [ -z "${header}" ]
191
+   then
192
+      local name
193
+
194
+      name="`fast_basename "${address}"`"
195
+      header="${name}.h"
196
+   fi
197
+
198
+   _emit_c_include "${address}" "${header}" "${marks}"
199
+
200
+}
201
+
202
+
203
+emit_c_include_dependency()
204
+{
205
+   log_entry "emit_c_include_dependency" "$@"
206
+
207
+   local address="$1"
208
+   local marks="$2"
209
+   local header="$3"
210
+
211
+   #
212
+   # the default for dependencies is <name/name.h>
213
+   #
214
+   if [ -z "${header}" ]
215
+   then
216
+      local name
217
+
218
+      name="`fast_basename "${address}"`"
219
+      header="${name}/${name}.h"
220
+   fi
221
+
222
+   _emit_c_include "${address}" "${header}" "${marks}"
223
+}
224
+
225
+
226
+emit_c_header()
227
+{
228
+   log_entry "emit_c_header" "$@"
229
+
230
+   local marks="$1"
231
+
232
+   local filter_marks
233
+
234
+   filter_marks="`comma_concat "header" "${marks}" `"
235
+
236
+   # since the order of the headers is important and needs to be in treeorder
237
+   # we use mulle-sourcetree directly
238
+   local headers
239
+
240
+   headers="`exekutor mulle-sourcetree list \
241
+                                       --format "%a;%m;%i={include,,-------}\\n" \
242
+                                       --marks "${filter_marks}" \
243
+                                       --output-raw \
244
+                                       --no-output-header`" || return 1
245
+
246
+   local dependency
247
+
248
+   set -o noglob ; IFS="
249
+"
250
+   for header in ${headers}
251
+   do
252
+      IFS="${DEFAULT_IFS}"; set +o noglob
253
+
254
+      local address
255
+      local marks
256
+      local include
257
+
258
+      IFS=";" read address marks include <<< "${header}"
259
+
260
+      if [ -z "${address}" ]
261
+      then
262
+         continue
263
+      fi
264
+
265
+      log_verbose "Emit cmake statements for ${C_MAGENTA}${C_BOLD}${address}"
266
+
267
+      case ",${marks}," in
268
+         *,no-dependency,*)
269
+            emit_c_include_library "${address}" \
270
+                                   "${marks}" \
271
+                                   "${include}" \
272
+                                   "$@"
273
+         ;;
274
+
275
+         *)
276
+            emit_c_include_dependency "${address}" \
277
+                                      "${marks}" \
278
+                                      "${include}" \
279
+                                      "$@"
280
+         ;;
281
+      esac
282
+   done
283
+
284
+   IFS="${DEFAULT_IFS}"; set +o noglob
285
+}
286
+
287
+
288
+c_include()
289
+{
290
+   log_entry "c_include" "$@"
291
+
292
+   local projectname="$1"
293
+   local projectidentifier="$2"
294
+
295
+   local text_h
296
+
297
+   if [ "${MULLE_SDE_INCLUDE_FILENAME}" = "NONE" ]
298
+   then
299
+      return
300
+   fi
301
+   if [ -z "${MULLE_SDE_INCLUDE_FILENAME}" ]
302
+   then
303
+      MULLE_SDE_INCLUDE_FILENAME="${PROJECT_SOURCE_DIR}/_${projectname}-include.h"
304
+   fi
305
+
306
+   local marks
307
+
308
+   case "${PROJECT_DIALECT}" in
309
+      'objc')
310
+         marks="no-import,public"
311
+      ;;
312
+
313
+      *)
314
+         marks="public"
315
+      ;;
316
+   esac
317
+
318
+   text_h="`emit_c_header "${marks}"`" || exit 1
319
+
320
+   if [ -z "${text_h}" ]
321
+   then
322
+      text_h="/* no headers */"
323
+   fi
324
+
325
+   text_h="/*
326
+   This file will be regenerated by \`mulle-sde update|monitor\`.
327
+   Edits will be lost.
328
+*/
329
+
330
+#ifndef _${projectidentifier}_include_h__
331
+#define _${projectidentifier}_include_h__
332
+
333
+${text_h}
334
+
335
+#endif"
336
+
337
+   log_verbose "Writing ${C_RESET_BOLD}${MULLE_SDE_INCLUDE_FILENAME}"
338
+   redirect_exekutor "${MULLE_SDE_INCLUDE_FILENAME}" echo "${text_h}"
339
+}
340
+
341
+
342
+objc_import()
343
+{
344
+   log_entry "objc_import" "$@"
345
+
346
+   local projectname="$1"
347
+   local projectidentifier="$2"
348
+
349
+   local text_h
350
+
351
+   if [ "${MULLE_SDE_IMPORT_FILENAME}" = "NONE" ]
352
+   then
353
+      return
354
+   fi
355
+   if [ -z "${MULLE_SDE_IMPORT_FILENAME}" ]
356
+   then
357
+      MULLE_SDE_IMPORT_FILENAME="${PROJECT_SOURCE_DIR}/_${projectname}-import.h"
358
+   fi
359
+
360
+   text_h="`emit_c_header "import,public"`" || exit 1
361
+
362
+   if [ -z "${text_h}" ]
363
+   then
364
+      text_h="/* no headers */"
365
+   fi
366
+
367
+
368
+   text_h="/*
369
+   This file will be regenerated by \`mulle-sde update|monitor\`.
370
+   Edits will be lost.
371
+*/
372
+
373
+#ifndef _${projectidentifier}_import_h__
374
+#define _${projectidentifier}_import_h__
375
+
376
+${text_h}
377
+
378
+#endif"
379
+
380
+   log_verbose "Writing ${C_RESET_BOLD}${MULLE_SDE_IMPORT_FILENAME}"
381
+   redirect_exekutor "${MULLE_SDE_IMPORT_FILENAME}" echo "${text_h}"
382
+}
383
+
384
+
385
+c_include_private()
386
+{
387
+   log_entry "c_include_private" "$@"
388
+
389
+   local projectname="$1"
390
+   local projectidentifier="$2"
391
+
392
+   local text_h
393
+
394
+   if [ "${MULLE_SDE_INCLUDE_PRIVATE_FILENAME}" = "NONE" ]
395
+   then
396
+      return
397
+   fi
398
+   if [ -z "${MULLE_SDE_INCLUDE_PRIVATE_FILENAME}" ]
399
+   then
400
+      MULLE_SDE_INCLUDE_PRIVATE_FILENAME="${PROJECT_SOURCE_DIR}/_${projectname}-include-private.h"
401
+   fi
402
+
403
+   local marks
404
+
405
+   case "${PROJECT_DIALECT}" in
406
+      'objc')
407
+         marks="no-import,no-public"
408
+      ;;
409
+
410
+      *)
411
+         marks="no-public"
412
+      ;;
413
+   esac
414
+
415
+   text_h="`emit_c_header "${marks}"`" || exit 1
416
+
417
+   if [ -z "${text_h}" ]
418
+   then
419
+      text_h="/* no headers */"
420
+   fi
421
+
422
+   text_h="/*
423
+   This file will be regenerated by \`mulle-sde update|monitor\`.
424
+   Edits will be lost.
425
+*/
426
+
427
+#ifndef _${projectidentifier}_include_private_h__
428
+#define _${projectidentifier}_include_private_h__
429
+
430
+${text_h}
431
+
432
+#endif"
433
+
434
+   log_verbose "Writing ${C_RESET_BOLD}${MULLE_SDE_INCLUDE_PRIVATE_FILENAME}"
435
+   redirect_exekutor "${MULLE_SDE_INCLUDE_PRIVATE_FILENAME}" echo "${text_h}"
436
+}
437
+
438
+
439
+objc_import_private()
440
+{
441
+   log_entry "objc_import_private" "$@"
442
+
443
+   local projectname="$1"
444
+   local projectidentifier="$2"
445
+
446
+   local text_h
447
+
448
+   if [ "${MULLE_SDE_IMPORT_PRIVATE_FILENAME}" = "NONE" ]
449
+   then
450
+      return
451
+   fi
452
+   if [ -z "${MULLE_SDE_IMPORT_PRIVATE_FILENAME}" ]
453
+   then
454
+      MULLE_SDE_IMPORT_PRIVATE_FILENAME="${PROJECT_SOURCE_DIR}/_${projectname}-import-private.h"
455
+   fi
456
+
457
+   text_h="`emit_c_header "import,no-public"`" || exit 1
458
+
459
+   if [ -z "${text_h}" ]
460
+   then
461
+      text_h="/* no headers */"
462
+   fi
463
+
464
+
465
+   text_h="/*
466
+   This file will be regenerated by \`mulle-sde update|monitor\`.
467
+   Edits will be lost.
468
+*/
469
+
470
+#ifndef _${projectidentifier}_import_private_h__
471
+#define _${projectidentifier}_import_private_h__
472
+
473
+${text_h}
474
+
475
+#endif"
476
+
477
+   log_verbose "Writing ${C_RESET_BOLD}${MULLE_SDE_IMPORT_PRIVATE_FILENAME}"
478
+   redirect_exekutor "${MULLE_SDE_IMPORT_PRIVATE_FILENAME}" echo "${text_h}"
479
+}
480
+
481
+
482
+main()
483
+{
484
+   log_entry "main" "$@"
485
+
486
+   # technical flags
487
+   local MULLE_TRACE
488
+   local MULLE_FLAG_DONT_DEFER="NO"
489
+   local MULLE_FLAG_EXEKUTOR_DRY_RUN="NO"
490
+   local MULLE_FLAG_FOLLOW_SYMLINKS="YES"
491
+   local MULLE_FLAG_LOG_CACHE="NO"
492
+   local MULLE_FLAG_LOG_DEBUG="NO"
493
+   local MULLE_FLAG_LOG_EXEKUTOR="NO"
494
+   local MULLE_FLAG_LOG_FLUFF="NO"
495
+   local MULLE_FLAG_LOG_MERGE="NO"
496
+   local MULLE_FLAG_LOG_SCRIPTS="NO"
497
+   local MULLE_FLAG_LOG_SETTINGS="NO"
498
+   local MULLE_FLAG_LOG_VERBOSE="NO"
499
+   local MULLE_TRACE_PATHS_FLIP_X="NO"
500
+   local MULLE_TRACE_POSTPONE="NO"
501
+   local MULLE_TRACE_RESOLVER_FLIP_X="NO"
502
+   local MULLE_TRACE_SETTINGS_FLIP_X="NO"
503
+
504
+   local OPTION_IMPORT="DEFAULT"
505
+
506
+   while [ $# -ne 0 ]
507
+   do
508
+      if options_technical_flags "$1"
509
+      then
510
+         shift
511
+         continue
512
+      fi
513
+
514
+      case "$1" in
515
+         -h*|--help|help)
516
+            usage
517
+         ;;
518
+
519
+         --import)
520
+            OPTION_IMPORT="YES"
521
+         ;;
522
+
523
+         --no-import)
524
+            OPTION_IMPORT="NO"
525
+         ;;
526
+
527
+         -p|--project-name)
528
+            [ "$#" -eq 1 ] && usage "Missing argument to \"$1\""
529
+            shift
530
+
531
+            PROJECT_NAME="$1"
532
+         ;;
533
+
534
+         -t|--project-type)
535
+            [ "$#" -eq 1 ] && usage "Missing argument to \"$1\""
536
+            shift
537
+
538
+            PROJECT_TYPE="$1"
539
+         ;;
540
+
541
+         --project-source-dir)
542
+            [ "$#" -eq 1 ] && usage "Missing argument to \"$1\""
543
+            shift
544
+
545
+            PROJECT_SOURCE_DIR="$1"
546
+         ;;
547
+
548
+         --project-dialect)
549
+            [ "$#" -eq 1 ] && usage "Missing argument to \"$1\""
550
+            shift
551
+
552
+            PROJECT_DIALECT="$1"
553
+         ;;
554
+
555
+         -*)
556
+            log_error "Unknown option \"$1\""
557
+            usage
558
+         ;;
559
+
560
+         *)
561
+            break
562
+         ;;
563
+      esac
564
+
565
+      shift
566
+   done
567
+
568
+   options_setup_trace "${MULLE_TRACE}"
569
+
570
+   if [ -z "${MULLE_CASE_SH}" ]
571
+   then
572
+      # shellcheck source=mulle-case.sh
573
+      . "${MULLE_BASHFUNCTIONS_LIBEXEC_DIR}/mulle-case.sh"      || return 1
574
+   fi
575
+
576
+   if [ -z "${PROJECT_NAME}" ]
577
+   then
578
+      PROJECT_NAME="`fast_basename "${PWD}"`" # could be nicer
579
+   fi
580
+
581
+   local PROJECT_IDENTIFIER
582
+   local PROJECT_DOWNCASE_IDENTIFIER
583
+
584
+   PROJECT_IDENTIFIER="`tweaked_de_camel_case "${PROJECT_NAME}"`"
585
+   PROJECT_IDENTIFIER="`printf "%s" "${PROJECT_IDENTIFIER}" | tr -c 'a-zA-Z0-9' '_'`"
586
+   PROJECT_DOWNCASE_IDENTIFIER="`tr 'A-Z' 'a-z' <<< "${PROJECT_IDENTIFIER}"`"
587
+
588
+   [ -z "${PROJECT_SOURCE_DIR}" ] && internal_fail "PROJECT_SOURCE_DIR not set"
589
+   [ -z "${PROJECT_DIALECT}" ] && log_warning "PROJECT_DIALECT not set"
590
+
591
+   c_include "${PROJECT_NAME}" "${PROJECT_DOWNCASE_IDENTIFIER}"
592
+   c_include_private "${PROJECT_NAME}" "${PROJECT_DOWNCASE_IDENTIFIER}"
593
+
594
+   if [ "${PROJECT_DIALECT}" = "objc" ]
595
+   then
596
+      if [ "${OPTION_IMPORT}" = "DEFAULT" ]
597
+      then
598
+         OPTION_IMPORT="YES"
599
+      fi
600
+
601
+      objc_import "${PROJECT_NAME}" "${PROJECT_DOWNCASE_IDENTIFIER}"
602
+      objc_import_private "${PROJECT_NAME}" "${PROJECT_DOWNCASE_IDENTIFIER}"
603
+   fi
604
+}
605
+
606
+
607
+_init()
608
+{
609
+   if [ -z "${MULLE_BASHFUNCTIONS_LIBEXEC_DIR}" ]
610
+   then
611
+      MULLE_BASHFUNCTIONS_LIBEXEC_DIR="`mulle-bashfunctions-env "libexec-dir" 2> /dev/null`"
612
+      [ -z "${MULLE_BASHFUNCTIONS_LIBEXEC_DIR}" ] && \
613
+         echo "mulle-bashfunctions-env not installed" >&2 && \
614
+         exit 1
615
+   fi
616
+
617
+   . "${MULLE_BASHFUNCTIONS_LIBEXEC_DIR}/mulle-bashfunctions.sh" "minimal" || exit 1
618
+}
619
+
620
+_init "$@"
621
+main "$@"
622
+
0 623
new file mode 100755
... ...
@@ -0,0 +1,146 @@
1
+#!/usr/bin/env bash
2
+
3
+
4
+get_includes()
5
+{
6
+   local filename="$1"
7
+
8
+   sed -n -e 's/^.*include([ ]*\([^) ]*\)[ ]*\([^ ]*\)[ ]*).*/\1;\2/p' "${filename}"
9
+}
10
+
11
+
12
+find_cmake_file()
13
+{