-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile-update-oommf
179 lines (146 loc) · 6.23 KB
/
Makefile-update-oommf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# This file is run rarely - only when there is a new version of OOMMF
# (or if one of the extensions we add in part 2. is updated).
#
# 1. Fetch the oommf sources (in preration to adding them to
# this repository).
#
# This appears somewhat lengthy because we want to add some
# additional files to the repository, that make it easy to
# reconstruct exactly from which sources this version of OOMMF
# originates.
#
# Compose name of OOMMF tar ball as available on NIST webpages
# (as of September 2015, still valid 2022)
OOMMF_ROOT="oommf"
OOMMFVERSION="21a0"
# USE dot in conda version numbers:
OOMMFVERSIONCONDA="2.1a0"
# The release date shown on webpage
OOMMFDATE="20230927"
OOMMFBUILD="a0"
OOMMFROOTNAME=$(OOMMF_ROOT)$(OOMMFVERSION)
# Any additional modifier (could be empty, was first needed for "-hotfix" 2.0a2, 20200608)
OOMMFSOURCEMODIFIER=""
OOMMFSOURCEFILE=$(OOMMFROOTNAME)_$(OOMMFDATE)$(OOMMFSOURCEMODIFIER).tar.gz
OOMMFSOURCEURL=http://math.nist.gov/oommf/dist/$(OOMMFSOURCEFILE)
# example https://math.nist.gov/oommf/dist/oommf20b0_20220930.tar.gz
OOMMFPRECOMPILEDFILE=$(OOMMFROOTNAME)_$(OOMMFDATE)$(OOMMFSOURCEMODIFIER)_86_x64.zip
OOMMFPRECOMPILEDURL=https://math.nist.gov/oommf/dist/$(OOMMFPRECOMPILEDFILE)
# example https://math.nist.gov/oommf/dist/oommf20b0_20220930_86_x64.zip
GITREPOHASH=$(shell git rev-list HEAD -1)
fetch-oommf:
make -f Makefile-update-oommf clean
make -f Makefile-update-oommf get-oommf
make -f Makefile-update-oommf untar-oommf
make -f Makefile-update-oommf update-logfile
make -f Makefile-update-oommf update-oommf-version
make -f Makefile-update-oommf apply-patches
make -f Makefile-update-oommf get-oommf-precompiled
@# @echo "things to do now:"
@# @echo "1. Potentially commit (with the new OOMMF source files [if tests pass]). "
@# @echo "2. Run 'make get-all' to get all additional extensions. "
@# @echo "3. Run git 'commit -a' or similar to update git repo with new release [if tests pass]"
@# @echo "4. Tag the revisision (conda-forge recipe needs this):"
@# @# something like: " git tag 1.2b0_20160930b1 d4e20846611d545441c0d71267d8d59f1ea99823"
@# @echo "git tag $(OOMMFVERSIONCONDA)_$(OOMMFDATE)$(OOMMFBUILD) XXXHASHFROMLASTCOMMITXXX"
@# @echo "5. Update oommf/package.py in Spack to support the new release"
clean:
rm -rf oommf
rm -rf tmp_git_clone
rm -rf Downloads
get-oommf:
mkdir -p Downloads
cd Downloads && wget $(OOMMFSOURCEURL)
get-oommf-precompiled:
cd precompiled && wget $(OOMMFPRECOMPILEDURL)
untar-oommf:
tar xfvz Downloads/$(OOMMFSOURCEFILE)
update-logfile:
echo "=======================================================" >> versionlog.txt
echo "date: `date` " >> versionlog.txt
echo " unpacked $(OOMMFSOURCEFILE)" >> versionlog.txt
echo " OOMMF:" >> versionlog.txt
echo " version: $(OOMMFVERSION)" >> versionlog.txt
echo " date: $(OOMMFDATE)" >> versionlog.txt
echo " build: $(OOMMFBUILD)" >> versionlog.txt
echo " modified: $(OOMMFSOURCEMODIFIER)" >> versionlog.txt
echo " source-url: $(OOMMFSOURCEURL)" >> versionlog.txt
echo " github-url: https://github.com/fangohr/oommf" >> versionlog.txt
echo " github version: $(GITREPOHASH)" >> versionlog.txt
update-oommf-version:
echo "$(OOMMFVERSION) $(OOMMFDATE) $(OOMMFBUILD)" > oommf-version
apply-patches:
echo "Applying patches ..."
@# patch from Ryan Pepper to allow compilation on OS X 10.11
@# (already applied into latest OOMMF version)
@# patch -b oommf/config/platforms/darwin.tcl < patches/darwin.tcl.1.2a6.patch
@# echo " patch applied: patches/darwin.tcl.1.2a6.patch" >> versionlog.txt
@# record original file in repository.
@# git add oommf/config/platforms/darwin.tcl.orig
@# when this patch is removed, the file above should also be removed from the repo.
#
# 2. OOMMF extensions that we fetch and add to the repository
#
# Again, this appears somewhat lengthy because we want to add some
# additional files to the repository, that make it easy to
# reconstruct exactly from which repository each added extensions
# originates, and which version of the repository it is.
# We also add a snapshot of teh extension repository as a zip file.
# This may contain useful documentation or examples.
#
DMICNVREPO="oommf-extension-dmi-cnv"
DMITREPO="oommf-extension-dmi-t"
DMID2DREPO="oommf-extension-dmi-d2d"
MELREPO="oommf-mel"
SPINTEVOLVE3DREPO="anv-spintevolve-3d"
get-cnv:
python3 clone-log-and-extract-src.py https://github.com/joommf/$(DMICNVREPO).git src
get-t:
python3 clone-log-and-extract-src.py https://github.com/joommf/$(DMITREPO).git src
get-d2d:
python3 clone-log-and-extract-src.py https://github.com/joommf/$(DMID2DREPO).git src
get-mel:
python3 clone-log-and-extract-src.py https://github.com/yuyahagi/$(MELREPO).git .
get-spintevolve-3d:
python3 clone-log-and-extract-src.py https://github.com/oommf-extensions/$(SPINTEVOLVE3DREPO).git src
fetch-all-extensions: get-cnv get-d2d get-t get-mel get-spintevolve-3d
#
# 3. Master target that fetches OOMMF (step 1) and the extensions (step 2)
#
all:
make -f Makefile-update-oommf fetch-oommf
make -f Makefile-update-oommf fetch-all-extensions
@echo "to build and test use 'make build test-all'"
#
# For continuous integration
#
# Note: it is not clear how sensible the steps below are.
# These can fail for a number of reasons, that do not matter
# to people using this git repository of OOMMF source code with
# additional extensions:
#
# - download of sources fail
# - compilation fails, for example because the extensions has changed. In this
# case ...
#
#
# This is used by the in-docker-replay-oommf-update github workflow.
in-docker-replay-oommf-update:
@# Create Docker container with tk and tcl
docker build -t dockertestimage .
@# Start this as a daemon
docker run -ti -d --name testcontainer2 dockertestimage
@# rm all oommf files from repo
docker exec testcontainer2 make -f Makefile-update-oommf clean
@# fetch all oommf from NIST
docker exec testcontainer2 make -f Makefile-update-oommf fetch-oommf
@# fetch extensinos to be added
docker exec testcontainer2 make -f Makefile-update-oommf fetch-all-extensions
@# build the vanilla version with extensions
docker exec testcontainer2 make build
@# run some tests
docker exec testcontainer2 make test-all
@# stop docker container
docker stop testcontainer2
@# and remove it
docker rm testcontainer2