Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johannes Pfeifer
dynare
Commits
d5649a53
Verified
Commit
d5649a53
authored
1 year ago
by
Willi Mutschler
Browse files
Options
Downloads
Patches
Plain Diff
macOS built script: make shellcheck happy
Added double quotes to variables
parent
bb3aa0a2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
macOS/build.sh
+14
-15
14 additions, 15 deletions
macOS/build.sh
with
14 additions
and
15 deletions
macOS/build.sh
+
14
−
15
View file @
d5649a53
...
@@ -24,10 +24,10 @@ ROOTDIR=$(pwd)/..
...
@@ -24,10 +24,10 @@ ROOTDIR=$(pwd)/..
##
##
## Set settings based on architecture
## Set settings based on architecture
##
##
path_remove
()
{
export
$1
=
"
`
echo
-n
${
!1
}
|
awk
-v
RS
=
:
-v
ORS
=
:
'$1 != "'
$2
'"'
|
sed
's/:$//'
`
"
;
}
path_remove
()
{
export
"
$1
"
=
"
$(
echo
-n
"
${
!1
}
"
|
awk
-v
RS
=
:
-v
ORS
=
:
'$1 != "'
"
$2
"
'"'
|
sed
's/:$//'
)
"
;
}
path_prepend
()
{
path_remove
$1
$2
;
export
$1
=
"
$2
:
${
!1
}
"
;
}
path_prepend
()
{
path_remove
"
$1
"
"
$2
"
;
export
"
$1
"
=
"
$2
:
${
!1
}
"
;
}
PKG_ARCH
=
$
1
PKG_ARCH
=
$
{
1
:-
x86_64
}
# default to x86_64
if
[[
$PKG_ARCH
==
arm64
]]
;
then
if
[[
"
$PKG_ARCH
"
==
arm64
]]
;
then
BREWDIR
=
/opt/homebrew
BREWDIR
=
/opt/homebrew
# Make sure /opt/homebrew/bin is set first in PATH (as it might come last)
# Make sure /opt/homebrew/bin is set first in PATH (as it might come last)
path_prepend PATH /opt/homebrew/bin
path_prepend PATH /opt/homebrew/bin
...
@@ -59,7 +59,7 @@ LIB64="$ROOTDIR"/macOS/deps/"$PKG_ARCH"/lib64
...
@@ -59,7 +59,7 @@ LIB64="$ROOTDIR"/macOS/deps/"$PKG_ARCH"/lib64
GCC_VERSION
=
$(
sed
-En
"/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/
\1
/p"
"
$ROOTDIR
"
/scripts/homebrew-native-
"
$PKG_ARCH
"
.ini
)
GCC_VERSION
=
$(
sed
-En
"/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/
\1
/p"
"
$ROOTDIR
"
/scripts/homebrew-native-
"
$PKG_ARCH
"
.ini
)
QUADMATH_DIR
=
$(
mktemp
-d
)
QUADMATH_DIR
=
$(
mktemp
-d
)
ln
-s
$BREWDIR
/opt/gcc/lib/gcc/
$GCC_VERSION
/libquadmath.a
$QUADMATH_DIR
ln
-s
"
$BREWDIR
"
/opt/gcc/lib/gcc/
"
$GCC_VERSION
"
/libquadmath.a
"
$QUADMATH_DIR
"
##
##
## Compile Dynare
## Compile Dynare
...
@@ -73,17 +73,17 @@ common_meson_opts=(-Dbuild_for=matlab -Dbuildtype=release -Dprefer_static=true -
...
@@ -73,17 +73,17 @@ common_meson_opts=(-Dbuild_for=matlab -Dbuildtype=release -Dprefer_static=true -
# Build for MATLAB ⩾ R2018a (x86_64) and MATLAB ⩾ R2023b (arm64)
# Build for MATLAB ⩾ R2018a (x86_64) and MATLAB ⩾ R2023b (arm64)
arch
-
"
$PKG_ARCH
"
meson setup
"
${
common_meson_opts
[@]
}
"
-Dmatlab_path
=
"
$MATLAB_PATH
"
build-matlab
--wipe
arch
-
"
$PKG_ARCH
"
meson setup
"
${
common_meson_opts
[@]
}
"
-Dmatlab_path
=
"
$MATLAB_PATH
"
build-matlab
--wipe
arch
-
$PKG_ARCH
meson compile
-v
-C
build-matlab
arch
-
"
$PKG_ARCH
"
meson compile
-v
-C
build-matlab
if
[[
$PKG_ARCH
==
x86_64
]]
;
then
if
[[
"
$PKG_ARCH
"
==
x86_64
]]
;
then
# Build for MATLAB < R2018a
# Build for MATLAB < R2018a
arch
-
"
$PKG_ARCH
"
meson setup
"
${
common_meson_opts
[@]
}
"
-Dmatlab_path
=
"
$OLD_MATLAB_PATH
"
build-old-matlab
--wipe
arch
-
"
$PKG_ARCH
"
meson setup
"
${
common_meson_opts
[@]
}
"
-Dmatlab_path
=
"
$OLD_MATLAB_PATH
"
build-old-matlab
--wipe
arch
-
$PKG_ARCH
meson compile
-v
-C
build-old-matlab
arch
-
"
$PKG_ARCH
"
meson compile
-v
-C
build-old-matlab
fi
fi
# If not in CI, build the docs
# If not in CI, build the docs
if
[[
-z
$CI
]]
;
then
if
[[
-z
$CI
]]
;
then
arch
-
$PKG_ARCH
meson compile
-v
-C
build-matlab doc
arch
-
"
$PKG_ARCH
"
meson compile
-v
-C
build-matlab doc
ln
-s
build-matlab build-doc
ln
-s
build-matlab build-doc
fi
fi
...
@@ -124,7 +124,7 @@ mkdir -p \
...
@@ -124,7 +124,7 @@ mkdir -p \
"
$PKGFILES
"
/doc
\
"
$PKGFILES
"
/doc
\
"
$PKGFILES
"
/scripts
\
"
$PKGFILES
"
/scripts
\
"
$PKGFILES
"
/contrib/ms-sbvar/TZcode
"
$PKGFILES
"
/contrib/ms-sbvar/TZcode
if
[[
$PKG_ARCH
==
x86_64
]]
;
then
if
[[
"
$PKG_ARCH
"
==
x86_64
]]
;
then
mkdir
-p
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-8
.3-9.3
\
mkdir
-p
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-8
.3-9.3
\
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-9
.4-23.2
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-9
.4-23.2
else
else
...
@@ -146,7 +146,7 @@ cp -p "$ROOTDIR"/build-matlab/preprocessor/src/dynare-preprocessor "$PKGFILES"
...
@@ -146,7 +146,7 @@ cp -p "$ROOTDIR"/build-matlab/preprocessor/src/dynare-preprocessor "$PKGFILES"
mkdir
-p
"
$PKGFILES
"
/matlab/preprocessor64
mkdir
-p
"
$PKGFILES
"
/matlab/preprocessor64
ln
-sf
../../preprocessor/dynare-preprocessor
"
$PKGFILES
"
/matlab/preprocessor64/dynare_m
ln
-sf
../../preprocessor/dynare-preprocessor
"
$PKGFILES
"
/matlab/preprocessor64/dynare_m
if
[[
$PKG_ARCH
==
x86_64
]]
;
then
if
[[
"
$PKG_ARCH
"
==
x86_64
]]
;
then
cp
-L
"
$ROOTDIR
"
/build-matlab/
*
.mex
"
$MATLAB_ARCH
"
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-9
.4-23.2
cp
-L
"
$ROOTDIR
"
/build-matlab/
*
.mex
"
$MATLAB_ARCH
"
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-9
.4-23.2
cp
-L
"
$ROOTDIR
"
/build-old-matlab/
*
.mex
"
$MATLAB_ARCH
"
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-8
.3-9.3
cp
-L
"
$ROOTDIR
"
/build-old-matlab/
*
.mex
"
$MATLAB_ARCH
"
"
$PKGFILES
"
/mex/matlab/
"
$MATLAB_ARCH
"
-8
.3-9.3
else
else
...
@@ -162,13 +162,13 @@ cp "$ROOTDIR"/build-doc/preprocessor/doc/*.pdf "$PKGFILES"
...
@@ -162,13 +162,13 @@ cp "$ROOTDIR"/build-doc/preprocessor/doc/*.pdf "$PKGFILES"
cp
-r
"
$ROOTDIR
"
/build-doc/dynare-manual.html
"
$PKGFILES
"
/doc
cp
-r
"
$ROOTDIR
"
/build-doc/dynare-manual.html
"
$PKGFILES
"
/doc
mkdir
-p
"
$PKGFILES
"
/matlab/modules/dseries/externals/x13/macOS/64
mkdir
-p
"
$PKGFILES
"
/matlab/modules/dseries/externals/x13/macOS/64
cp
-p
"
$ROOTDIR
"
/macOS/deps/
$PKG_ARCH
/lib64/x13as/x13as
"
$PKGFILES
"
/matlab/modules/dseries/externals/x13/macOS/64
cp
-p
"
$ROOTDIR
"
/macOS/deps/
"
$PKG_ARCH
"
/lib64/x13as/x13as
"
$PKGFILES
"
/matlab/modules/dseries/externals/x13/macOS/64
cd
"
$ROOTDIR
"
/macOS/pkg
cd
"
$ROOTDIR
"
/macOS/pkg
# Dynare option
# Dynare option
arch
-
$PKG_ARCH
pkgbuild
--root
"
$PKGFILES
"
--identifier
org.dynare.
"
$VERSION
"
--version
"
$VERSION
"
--install-location
/Applications/Dynare/
"
$LOCATION
"
"
$NAME
"
.pkg
arch
-
"
$PKG_ARCH
"
pkgbuild
--root
"
$PKGFILES
"
--identifier
org.dynare.
"
$VERSION
"
--version
"
$VERSION
"
--install-location
/Applications/Dynare/
"
$LOCATION
"
"
$NAME
"
.pkg
# Create distribution.xml by replacing variables in distribution_template.xml
# Create distribution.xml by replacing variables in distribution_template.xml
sed
-e
"s/VERSION_NO_SPACE/
$VERSION
/g"
\
sed
-e
"s/VERSION_NO_SPACE/
$VERSION
/g"
\
...
@@ -178,7 +178,6 @@ sed -e "s/VERSION_NO_SPACE/$VERSION/g" \
...
@@ -178,7 +178,6 @@ sed -e "s/VERSION_NO_SPACE/$VERSION/g" \
# Create welcome.html by replacing variables in welcome_template.html
# Create welcome.html by replacing variables in welcome_template.html
sed
-e
"s/VERSION_NO_SPACE/
$VERSION
/g"
\
sed
-e
"s/VERSION_NO_SPACE/
$VERSION
/g"
\
-e
"s/DATE/
$DATELONG
/g"
\
-e
"s/DATE/
$DATELONG
/g"
\
-e
"s/GCC_VERSION/
$GCC_VERSION
/g"
\
"
$ROOTDIR
"
/macOS/welcome_template.html
>
"
$ROOTDIR
"
/macOS/welcome.html
"
$ROOTDIR
"
/macOS/welcome_template.html
>
"
$ROOTDIR
"
/macOS/welcome.html
# Create conclusion.html by replacing variables in conclusion_template.html
# Create conclusion.html by replacing variables in conclusion_template.html
...
@@ -186,7 +185,7 @@ sed -e "s/GCC_VERSION/$GCC_VERSION/g" \
...
@@ -186,7 +185,7 @@ sed -e "s/GCC_VERSION/$GCC_VERSION/g" \
"
$ROOTDIR
"
/macOS/conclusion_template.html
>
"
$ROOTDIR
"
/macOS/conclusion.html
"
$ROOTDIR
"
/macOS/conclusion_template.html
>
"
$ROOTDIR
"
/macOS/conclusion.html
# Create installer
# Create installer
arch
-
$PKG_ARCH
productbuild
--distribution
distribution.xml
--resources
"
$ROOTDIR
"
/macOS
--package-path
./
"
$NAME
"
.pkg
"
$NAME
"
-productbuild
.pkg
arch
-
"
$PKG_ARCH
"
productbuild
--distribution
distribution.xml
--resources
"
$ROOTDIR
"
/macOS
--package-path
./
"
$NAME
"
.pkg
"
$NAME
"
-productbuild
.pkg
# Cleanup
# Cleanup
rm
-f
./distribution.xml
rm
-f
./distribution.xml
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment