summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-asy
blob: ec86af4dd5aa6321ea8b5bed7bcb7697e07c7a5e (plain)
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
180
#!/bin/sh
# $Id$
# Public domain.  Originally written 2008, Karl Berry.
# Info about updating asymptote.
# 
# Do not just run this script. It won't work. It is necessary to run the
# commands one at a time and think about what is being done.
# 
# Also, the script uses various paths and convenience variables that I
# define for myself; feel free to peruse tug.org:~karl/.bash_login, etc.
# --karl

# but running the script is nevertheless useful sometimes, as described below.
test "x$1" = x--build || test "x$1" = x--bin-github || exit 1

renice +19 -p $$ >/dev/null 2>&1

fatal () { echo "$0: goodbye, $*" >&2; exit 1; }

# 
if false && $update_sources_from_ctan; then
  # this part is about copying the sources from CTAN to TL.
  cd $B/source/utils/
  # be sure no dregs:
  (cd asymptote && make distclean; rm -f Makefile; sup && sat) 
  \cp -arf /home/ftp/tex-archive/graphics/asymptote/ .

  cd asymptote
  ver=`awk -F\" '{print $2}' revision.cc | sed 1q` # the newly-released version
  echo $ver
  edit ../README for $ver

  # show list of new files to add:
  svn status | sed -n 's/^\?//p'
  svn add `!!`
  
  # show list of files to remove:
  diff -qr . /home/ftp/tex-archive/graphics/asymptote/ \
  | egrep -v ' differ' | egrep -v '\.svn|/binaries' | tee /tmp/asyrm
  sed -e 's,: ,/,' -e 's/^Only in //' /tmp/asyrm
  svn rm `!!`

  # final check and commit:
  svn status | fgrep \? #  # don't worry about binaries.
  svn commit -m"asy $ver sources" . ../README

# 
elif test "x$1" = x--build; then
  # this part is about building the x86 linux asymptote on tug.org.
  # Despite all the dire warnings above, this part can be executed.
  unset GREP_OPTIONS CDPATH
  PATH=/usr/bin:/usr/sbin; export PATH # system gcc for sake of shared libs
  PATH=$PATH:/usr/local/gnu/bin	       # libtool required
  PATH=$lb:$PATH		       # get our kpsewhich
  PYTHON=python3.9; export PYTHON      # 3.6 is too old
  svn=/usr/local/bin/svn               # so we need our svn explicitly
  set -x
  rhtoolset=/opt/rh/gcc-toolset-13/enable
  test -s $rhtoolset && . $rhtoolset
  
  set -e
  cd /home/texlive/karl/Build/source/utils/asymptote
  $svn update
  $svn revert asy-keywords.el
  $svn status
  if test -f Makefile; then
    make clean
    $svn revert doc/asy-latex.pdf
    rm -f Makefile
  fi
  rm -rf config.cache config.h config.log config.status errors.temp
  rm -rf /tmp/ainst autom4te.cache
  ./configure --prefix=/tmp/ainst --enable-static \
    --with-latex=/tmp/ainst/latex --with-context=/tmp/ainst/context \
    --disable-fftw --disable-gl --disable-gsl --disable-lsp \
    --enable-texlive-build \
    CFLAGS=-g \
    LDFLAGS="-static-libgcc -static-libstdc++"
  make -j`nproc` SILENT_MAKE=
  make check
  make install-prebuilt
  exit 0

# 
elif false && $update_runtime_from_ainst; then
  # this part is about copying the results of a successful build 
  # and install (from the previous section) into the Master/texmf runtime.
  # This should be done only when new binaries are being commited,
  # because support files and binaries are required to match versions.
  cp="cp -afv"

  xu=$B/source/utils
  xy=$xu/asymptote
  cd $xy
  make distclean
  ver=`awk -F\" '{print $2}' revision.cc | sed 1q`; echo $ver
  #
  $cp binaries/x86_64-windows/texlive/asy.exe $pg/asymptote64/
  # also check dlls:
  ls -lR binaries/x86_64-windows/texlive/ $tm/tlpkg/asymptote64/

  cd /tmp/ainst
  $cp share/info/{*/,}*.info $xist/doc/info
  $cp share/man/man1/asy.1 $xist/doc/man/man1/asy.1
  $cp share/man/man1/xasy.1x $xist/doc/man/man1/xasy.1
  $cp -r share/doc/asymptote $xist/doc
  #
  $cp -r share/asymptote $xist
  #
  $cp latex/asymptote/* $xist/tex/latex/asymptote/
  $cp context*/asymptote/* $xist/tex/context/third/asymptote/

  make -C $xist/doc/man
  
  ci="$xu/README \
    $xy \
    $pb/tl-update-asy \
    $pg/asymptote* \
    $xist/doc/info/  $xist/doc/man $xist/doc/asymptote \
    $xist/asymptote/ $xist/tex/*/asymptote"

  svn status $ci | sed -n 's/^\?//p'
  svn add `!!`

  cd /tmp/ainst
  xmf=/home/texlive/karl/Master/texmf-dist
  diff -qr share/asymptote/ $xmf/asymptote/ | fgrep -v .svn
  #svn rm ...

  diff -qr share/doc/asymptote/ $xmf/doc/asymptote/ | fgrep -v .svn
  #svn rm ...

  svn status $ci  # just to see
  scom -m"asymptote $ver support files + windows binary" $ci

# 
elif test "x$1" = x--bin-github; then
  # The x86_64-linux binary and other platforms are built via github. See
  # Build/source/.github/scripts/build-asy.sh (and workflows/build-asy.yml),
  # siblings to the main TL build files there.
  # 
  # The sources are synced every five minutes; see
  #   https://github.com/TeX-Live/texlive-source/actions/.
  #   
  # The main.yml workflow will run automatically to build all of TL
  # (and takes hours to complete); the build-asy.yml workflow has to be
  # triggered manually from
  #  https://github.com/TeX-Live/texlive-source/actions/workflows/build-asy.yml
  # 
  # Then, if it succeeds, the artifacts produced will appear on the
  #   result page and can be downloaded from there. The download links
  #   only work in a browser, not wget or curl.
  # 
  # Then can run this script with --bin-github *.zip to install the
  #   available zips in the bin directories.
  shift
  mydir=`dirname $0`
  Master=`cd $mydir/../.. && pwd`
  bin=$Master/bin
  test -d "$bin" || fatal "no bin directory: $bin"
  echo "$0: installing into $bin..."

  for f in "$@"; do
    # filenames: asy-amd64-freebsd.zip  asy-i386-linux.zip
    #            asy-i386-freebsd.zip   asy-x86_64-linux.zip
    # and they unpack into a single file, asy-amd64-freebsd etc.
    
    # so, better be a known platform name.
    platname=`echo "$f" | sed -e 's/^asy-//' -e 's/\.zip$//'`
    platdir=$bin/$platname
    test -d "$platdir" || fatal "no platform bin directory: $platdir"
    
    # and we should be able to unpack into it.
    unzip -od "$platdir" "$f" || fatal "unzip -d $platdir failed"
    
    # and then we should be able to rename the binary to just asy.
    mv -v "$platdir/asy-$platname" "$platdir/asy" || fatal "mv failed"
  done
  # then do the commit in Master/bin manually.
fi