Skip to content

Commit f1bdb6b

Browse files
committed
Merge branch 'master' of github.com:swift-lang/swift-t
2 parents d47f246 + a3a58fd commit f1bdb6b

File tree

21 files changed

+177
-100
lines changed

21 files changed

+177
-100
lines changed

c-utils/code/configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ AC_PROG_CC
5151

5252
USE_CC=$( which $CC )
5353
AC_MSG_RESULT([using CC=$USE_CC])
54+
AC_MSG_RESULT([CC version: $( $CC --version ) ])
5455

5556
# Checks for header files
5657
AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h unistd.h])

dev/build/init-settings.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@ then
1313
fi
1414

1515
cp ${THIS}/swift-t-settings.sh.template ${THIS}/swift-t-settings.sh
16-
echo "Created ${THIS}/swift-t-settings.sh"
17-
echo "You may edit swift-t-settings.sh before building."
16+
17+
if (( ${CONDA_BUILD:-0} == 0 ))
18+
then
19+
# This output is suppressed during a conda build
20+
echo "Created ${THIS}/swift-t-settings.sh"
21+
echo "You may edit swift-t-settings.sh before building."
22+
fi

dev/conda/README.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ When testing an installation:
8080
Setup:
8181

8282
* Run `setup-conda.sh` to setup a working Conda environment
83+
** If needed, `$ conda install autoconf automake ant`
8384
* Run the Swift/T `dev/release/make-release-pkg.zsh` script to
8485
create the "exported" Swift/T source tree in `$TMP/distro`,
8586
where `$TMP` defaults to `/tmp`.
@@ -89,7 +90,7 @@ Setup:
8990

9091
Loop:
9192

92-
* Run `conda-platform.sh`. See notes there.
93+
* Run `conda-build.sh [PLATFORM]`. See notes there.
9394
** Provide `-r` to build with R
9495
* Check `conda-build.log` (`LOG`) for errors.
9596
* Add debug output to `build.sh` as needed to diagnose problems.
@@ -171,13 +172,13 @@ We restrict our M4 usage to:
171172
* `m4_include()`: does simple file insertion
172173
* `m4_ifelse()`: does conditional substitution +
173174
Syntax: `m4_ifelse(VALUE1, VALUE2, TEXT1)` ⇒ _if (VALUE1 == VALUE2) then insert TEXT1_
174-
* `getenv()`: substitutes in an environment variable value
175+
* `m4_getenv()`: substitutes in an environment variable value
175176

176-
See `dev/conda/common.m4` for `getenv()` - this is a different script from the `common.m4' for the Turbine submit scripts due to newline requirements.
177+
See `dev/conda/common.m4` for `m4_getenv()` - this is a different script from the `common.m4' for the Turbine submit scripts due to Spack packaging requirements.
177178

178179
Example:
179180
----
180-
m4_ifelse(getenv(ENABLE_R),`1',m4_include(pkgs-R.yaml))
181+
m4_ifelse(m4_getenv(ENABLE_R),`1',m4_include(pkgs-R.yaml))
181182
----
182183
means: if `$ENABLE_R == 1`, include file `pkgs-R.yaml` here.
183184

dev/conda/build-generic.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ set -o pipefail
2020
# PREFIX is provided by Conda
2121
# ENABLE_R may be set by meta.yaml
2222

23+
# Try to force everything to stdout for correct ordering
24+
# Also do this in PLATFORM/build.sh
25+
# Works on Mac: 2025-10-27
26+
exec 2>&1
27+
2328
log()
2429
{
2530
echo "build-generic.sh:" ${*}
@@ -152,18 +157,26 @@ fi
152157
# Edit swift-t-settings
153158
${SED_I[@]} -f $SETTINGS_SED swift-t-settings.sh
154159

160+
log "check aclocal"
161+
which aclocal # 2>&1
162+
163+
155164
# Build it!
156165
# Merge output streams to try to prevent buffering
157166
# problems with conda build
158167
{
159168
echo
160-
# Anaconda Autoconf 2.72 is buggy
169+
log "check aclocal"
170+
which aclocal
161171
log "build tools:"
162172
which m4 autoreconf aclocal autom4te mpicc
163-
m4 --version
173+
m4 --version | head -1
174+
# Anaconda Autoconf 2.72 is buggy
164175
autoreconf --version | head -1
165176
log "mpicc show:"
166177
mpicc -show
178+
log "mpicc version:"
179+
mpicc --version
167180
echo
168181
log "BUILD SWIFT-T START: $( date '+%Y-%m-%d %H:%M:%S' )"
169182
./build-swift-t.sh -vv 2>&1

dev/conda/common.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ dnl This file must have a newline at the end for OSX.
44
dnl Simply remove this text:
55
m4_define(`COMMENT', `')dnl
66
dnl This simply does environment variable substition when m4 runs:
7-
m4_define(`getenv', `m4_esyscmd(printf -- "$`$1'")')dnl
7+
m4_define(`m4_getenv', `m4_esyscmd(printf -- "$`$1'")')dnl
88
m4_divert

dev/conda/conda-build.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ setopt PIPE_FAIL
44

55
# CONDA BUILD
66
# Generic wrapper around `conda build'
7-
# Called by platform/conda-platform.sh
87
# Generates meta.yaml and runs `conda build'
9-
# Generates settings.sed for the Swift/T build
8+
# Generates settings.sed to edit swift-t-settings.sh
109
# Many exported environment variables here
1110
# are substituted into meta.yaml
1211
# This script runs in the CONDA_PLATFORM subdirectory
1312
# and should not change directories
14-
# A LOG is produced named platform/conda-build.log
13+
# A LOG is produced named CONDA_PLATFORM/conda-build.log
1514
# You can only run 1 job concurrently per Anaconda installation
1615
# because of the log and
1716
# because of meta.yaml
@@ -23,9 +22,10 @@ help()
2322
cat <<END
2423
2524
Options:
26-
conda-build.sh [-Cr] PLATFORM
27-
-C configure-only- generate meta.yaml and settings.sed, then stop
28-
-r for the R version
25+
conda-build.sh [-C] [-r RV] PLATFORM
26+
-C : configure-only-
27+
generate meta.yaml and settings.sed, then stop
28+
-r RV : enable R version RV
2929
3030
END
3131
exit
@@ -59,8 +59,9 @@ log "CONDA_PLATFORM: $CONDA_PLATFORM ${*}"
5959
source $SWIFT_T_TOP/dev/get-versions.sh
6060
export SWIFT_T_VERSION
6161
log "SWIFT/T VERSION: $SWIFT_T_VERSION"
62-
# Sets PYTHON_VERSION:
62+
# Setenvs PYTHON_VERSION: passed into meta.yaml: e.g. "3.12.11"
6363
source $DEV_CONDA/get-python-version.sh
64+
log "PYTHON_VERSION: $PYTHON_VERSION SERIES: $PYTHON_SERIES"
6465
# Optionally set R_VERSION from user argument:
6566
if (( ${#R} )) export R_VERSION=${R[2]}
6667

@@ -116,13 +117,17 @@ if (( ! ${#R} )) {
116117
export ENABLE_R=1
117118
export PKG_NAME="swift-t-r"
118119
}
120+
log "PKG_NAME: $PKG_NAME"
119121

120122
# Default dependencies:
121123
export USE_ANT=1
122124
export USE_GCC=1
125+
export USE_CLANG=0
123126
export USE_TK=0
124127
export USE_ZLIB=0
125128
export USE_ZSH=1
129+
export SPEC_MPICH="mpich-mpicc"
130+
export SPEC_CLANG=""
126131

127132
# Allow platform to modify dependencies
128133
source $DEV_CONDA/$CONDA_PLATFORM/deps.sh

dev/conda/conda-install.sh

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,48 +82,30 @@ then
8282
return 1
8383
fi
8484

85-
# Get 2nd token from the version string:
86-
PV=( $( python --version ) )
87-
PV=${PV[2]}
85+
source $DEV_CONDA/get-python-version.sh
8886

89-
print "using python:" $( which python ) "(v$PV)"
87+
print "using python:" $( which python ) $PYTHON_VERSION
9088
print "using conda: " $( which conda )
9189

9290
# conda env list
9391

9492
# Defaults:
93+
# A SPEC is a 'package==version' specifier.
94+
# The version may be omitted if we are flexible.
9595
USE_ANT=1
9696
USE_GCC=1
9797
USE_ZSH=1
98+
SPEC_CLANG=""
99+
SPEC_MPICH="mpich"
100+
SPEC_PYTHON="python"
101+
TK="tk"
98102

99103
# Load platform-specific settings:
100-
source $DEV_CONDA/$CONDA_PLATFORM/deps.sh
101-
102-
# Auto-configuration
103-
# PINs are version pins applied to the package names
104-
CLANG_PIN=""
105-
PIN_PV=""
106-
if [[ $CONDA_PLATFORM == "osx-arm64" ]] {
107-
SOLVER=( --solver classic )
108-
# Pin Python version for these versions:
109-
# On GitHub, Conda will try to change them!
110-
case $PV {
111-
3.9*) PIN_PV="==3.9.7" ;;
112-
3.10*) ;& # Fall-through
113-
3.11*) ;& # Fall-through
114-
3.12*) ;& # Fall-through
115-
3.13*) PIN_PV="==$PV" ;;
116-
*) print "conda-install.sh: unsupported Python version: '$PV'"
117-
exit 1 ;;
118-
}
119-
# Pin Clang for everything but Python 3.9
120-
# In Py 3.9, 18 => 18.1.7
121-
PIN_CLANG="-18==18.1.8"
122-
# if [[ $PV =~ 3.9 ]] {
123-
# PIN_CLANG="-18"
124-
# # SOLVER=()
125-
# }
126-
}
104+
if ! source $DEV_CONDA/$CONDA_PLATFORM/deps.sh
105+
then
106+
abortf "conda-install.sh: failed during source %s\n" \
107+
$DEV_CONDA/$CONDA_PLATFORM/deps.sh
108+
fi
127109

128110
# Build dependency list:
129111
LIST=()
@@ -132,16 +114,18 @@ if (( USE_GCC )) LIST+=gcc
132114
if (( USE_ZSH )) LIST+=zsh
133115
LIST+=(
134116
autoconf
117+
$SPEC_CLANG
135118
make
136-
mpich-mpicc
119+
$SPEC_MPICH
137120
openjdk
138121
# May need to pin version:
139-
"python$PIN_PV"
122+
$SPEC_PYTHON
140123
swig
124+
$SPEC_TK
141125
)
142126

143-
# # Needed for _strstr issue:
144-
if [[ $CONDA_PLATFORM == "osx-arm64" ]] LIST+=( "clang$PIN_CLANG" )
127+
# # # Needed for _strstr issue:
128+
# if [[ $CONDA_PLATFORM == "osx-arm64" ]] LIST+=( "clang$PIN_CLANG" )
145129

146130
# Needed for libstdc++ GLIBCXX version issue on GCE Jenkins:
147131
if [[ ${JENKINS_HOME:-} != "" ]] LIST+=( "gcc=14" )

dev/conda/get-python-version.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,17 @@ T=( $( python --version ) )
66
print "get-python-version.sh: Python version detected: $T"
77

88
export PYTHON_VERSION=${T[2]}
9+
10+
# ZSH syntax: Split e.g. "3.12.7" into ( 3 12 7 )
11+
VS=( ${(s:.:)PYTHON_VERSION} )
12+
13+
# Python version, just major.minor: e.g. "3.12"
14+
export PYTHON_VERSION_MM="${VS[1]}.${VS[2]}"
15+
16+
# Get the next Python version (as an upper bound for meta.yaml)
17+
NEXT_MINOR=$[ ${VS[2]} + 1 ]
18+
export PYTHON_NEXT_MM="${VS[1]}.${NEXT_MINOR}"
19+
20+
# Current Python series in meta.yaml range format:
21+
# E.g., >=3.12,<3.13
22+
export PYTHON_SERIES=">=${PYTHON_VERSION_MM},<${PYTHON_NEXT_MM}"

dev/conda/meta-template.yaml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,66 @@
11
COMMENT(
22
# META TEMPLATE YAML
33
# Will be filtered into PLATFORM/meta.yaml by conda-build.sh:m4
4+
# Any m4_getenv() values are substituted when m4 runs!
45
)
56

67
# Date that this meta.yaml was filtered from meta-template.yaml:
7-
# DATE: getenv(DATE)
8+
# DATE: m4_getenv(DATE)
89

9-
{% set name = "getenv(PKG_NAME)" %}
10-
{% set version = "getenv(SWIFT_T_VERSION)" %}
10+
{% set name = "m4_getenv(PKG_NAME)" %}
11+
{% set version = "m4_getenv(SWIFT_T_VERSION)" %}
1112
{% set major = version.rpartition('.')[0] %}
1213

1314
package:
1415
name: {{ name|lower }}
1516
version: {{ version }}
1617

1718
source:
18-
path: getenv(DISTRO)/swift-t-{{ version }}/swift-t-{{ version }}
19+
path: m4_getenv(DISTRO)/swift-t-{{ version }}/swift-t-{{ version }}
1920

2021
build:
2122
number: 1
2223
# Environment variables for build.sh must be listed here,
2324
# normal environment inheritance does not happen!
2425
script_env:
25-
- CONDA_PLATFORM=getenv(CONDA_PLATFORM)
26-
- GITHUB_ACTIONS=getenv(GITHUB_ACTIONS)
27-
m4_ifelse(getenv(ENABLE_R),`1',m4_include(env-R.yaml))
26+
- CONDA_PLATFORM=m4_getenv(CONDA_PLATFORM)
27+
- GITHUB_ACTIONS=m4_getenv(GITHUB_ACTIONS)
28+
m4_ifelse(m4_getenv(ENABLE_R),`1',m4_include(env-R.yaml))
2829

2930
# Remember to sync any dependency changes here with conda-install.sh
3031
requirements:
3132
build:
33+
- python m4_getenv(PYTHON_SERIES)
3234
# Anaconda Autoconf 2.72 is buggy 2025-05-12
3335
- autoconf==2.71
36+
# Automake is needed on osx-arm64: 2025-10-27
37+
- automake
3438
- make
3539
- openjdk>=17 # Security issue in Java < 11.72.19
36-
- mpich-mpicc
37-
- python==getenv(PYTHON_VERSION)
40+
- m4_getenv(SPEC_MPICH)
3841
- swig
39-
m4_ifelse(getenv(USE_ANT),`1',m4_include(pkgs-ant.yaml))
40-
m4_ifelse(getenv(USE_GCC),`1',m4_include(pkgs-gcc.yaml))
41-
m4_ifelse(getenv(USE_TK), `1',m4_include(pkgs-tk.yaml))
42-
m4_ifelse(getenv(USE_ZSH),`1',m4_include(pkgs-zsh.yaml))
43-
m4_ifelse(getenv(ENABLE_R),`1',m4_include(pkgs-R.yaml))
42+
m4_ifelse(m4_getenv(USE_ANT), `1',m4_include(pkgs-ant.yaml))m4_dnl
43+
m4_ifelse(m4_getenv(USE_CLANG),`1',m4_include(pkgs-clang.yaml))m4_dnl
44+
m4_ifelse(m4_getenv(USE_GCC), `1',m4_include(pkgs-gcc.yaml))m4_dnl
45+
m4_ifelse(m4_getenv(USE_TK), `1',m4_include(pkgs-tk.yaml))m4_dnl
46+
m4_ifelse(m4_getenv(USE_ZSH), `1',m4_include(pkgs-zsh.yaml))m4_dnl
47+
m4_ifelse(m4_getenv(ENABLE_R), `1',m4_include(pkgs-R.yaml))m4_dnl
4448
run:
45-
- mpich-mpicc
46-
- openjdk>=17 # Security issue in Java < 11.72.19
47-
- python==getenv(PYTHON_VERSION)
49+
- python m4_getenv(PYTHON_SERIES)
50+
- openjdk>=17
51+
- m4_getenv(SPEC_MPICH)
4852
- swig
49-
m4_ifelse(getenv(USE_GCC),`1',m4_include(pkgs-gcc.yaml))
50-
m4_ifelse(getenv(USE_TK), `1',m4_include(pkgs-tk.yaml))
51-
m4_ifelse(getenv(USE_ZSH),`1',m4_include(pkgs-zsh.yaml))
52-
m4_ifelse(getenv(ENABLE_R),`1',m4_include(pkgs-R.yaml))
53+
m4_ifelse(m4_getenv(USE_CLANG),`1',m4_include(pkgs-clang.yaml))m4_dnl
54+
m4_ifelse(m4_getenv(USE_GCC), `1',m4_include(pkgs-gcc.yaml))m4_dnl
55+
m4_ifelse(m4_getenv(USE_TK), `1',m4_include(pkgs-tk.yaml))m4_dnl
56+
m4_ifelse(m4_getenv(USE_ZSH), `1',m4_include(pkgs-zsh.yaml))m4_dnl
57+
m4_ifelse(m4_getenv(ENABLE_R), `1',m4_include(pkgs-R.yaml))m4_dnl
5358

5459
test:
5560
commands:
61+
- which swift-t
5662
- swift-t -v
63+
- swift-t -E 'trace(42);'
5764

5865
about:
5966
home: http://swift-lang.org/Swift-T

dev/conda/osx-arm64/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
21
# osx-arm64 BUILD SH
32
# Simply calls build-generic.
43
# `conda build` calls this as Bash.
54

5+
exec 2>&1
6+
7+
# Try to force everything to stdout for correct ordering
8+
# Works on Mac: 2025-10-27
69
echo "build.sh: START"
710

811
DEV_CONDA=$( cd $RECIPE_DIR/.. ; /bin/pwd -P )

0 commit comments

Comments
 (0)