upgrade.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. # Copyright (c) 2012-2025 Daniele Bartolini et al.
  4. set -eu
  5. git_clone () {
  6. local DEST=$1
  7. local REPO=$2
  8. local BRANCH=$3
  9. local COMMIT=${4-}
  10. local DEPTH=1
  11. if [ ! -z "${COMMIT}" ]; then
  12. DEPTH=100 # Ensure enough commits are available for COMMIT option to work.
  13. fi
  14. git clone "${REPO}" "${DEST}" --branch="${BRANCH}" --depth="${DEPTH}" --separate-git-dir="$(mktemp -u)"
  15. if [ ! -z "${COMMIT}" ]; then
  16. pushd "${PWD}" > /dev/null
  17. cd "${DEST}" \
  18. && git reset --hard "${COMMIT}" \
  19. && rm .git
  20. popd > /dev/null
  21. fi
  22. }
  23. update_luajit () {
  24. local DEST=3rdparty/luajit
  25. local REPO=https://github.com/LuaJIT/LuaJIT.git
  26. local BRANCH=v2.1
  27. # Download latest luajit.
  28. rm -rf "${DEST}"
  29. git_clone "${DEST}" "${REPO}" "${BRANCH}"
  30. # Cleanup.
  31. rm -rf "${DEST}"/.gitignore
  32. rm -rf "${DEST}"/doc
  33. rm -rf "${DEST:?}"/etc
  34. rm -rf "${DEST}"/Makefile
  35. rm -rf "${DEST}"/README
  36. # Bump affected resources versions.
  37. RESOURCE_TYPES_H=src/resource/types.h
  38. sed -Ei 's/(.*RESOURCE_VERSION_SCRIPT)(.*RESOURCE_VERSION\()([0-9]+)(.*)/echo "\1\2$((\3 + 1))\4"/ge' src/resource/types.h
  39. # Add changes and commit.
  40. git add -f "${DEST}"
  41. git add "${RESOURCE_TYPES_H}"
  42. git commit -m "3rdparty: update luajit"
  43. }
  44. update_bx () {
  45. local DEST=3rdparty/bx
  46. local REPO=https://github.com/bkaradzic/bx
  47. local BRANCH=master
  48. local COMMIT=ae17a19ca2198ecd028c09568037dcd59fb93ae7 # Avoid mandatory C++17.
  49. # Download latest bx.
  50. rm -rf "${DEST}"
  51. git_clone "${DEST}" "${REPO}" "${BRANCH}" "${COMMIT}"
  52. # Cleanup bx.
  53. rm -rf "${DEST}"/.appveyor.yml
  54. rm -rf "${DEST}"/.editorconfig
  55. rm -rf "${DEST}"/.gitattributes
  56. rm -rf "${DEST}"/.gitignore
  57. rm -rf "${DEST}"/.travis.yml
  58. rm -rf "${DEST}"/3rdparty/catch
  59. rm -rf "${DEST}"/makefile
  60. rm -rf "${DEST}"/README.md
  61. rm -rf "${DEST}"/scripts/bin2c.lua
  62. rm -rf "${DEST}"/scripts/lemon.lua
  63. rm -rf "${DEST}"/tests
  64. rm -rf "${DEST}"/tools
  65. # Ensure BX_CONFIG_DEBUG is set in development builds.
  66. sed -i 's/{ "Release" }$/{ "Release or development" }/' "${DEST}"/scripts/bx.lua
  67. sed -i 's/{ "Release" }$/{ "Release or development" }/' "${DEST}"/scripts/bx.lua
  68. git add -f "${DEST}"
  69. }
  70. update_bimg () {
  71. local DEST=3rdparty/bimg
  72. local REPO=https://github.com/bkaradzic/bimg
  73. local BRANCH=master
  74. local COMMIT=5d61905eb1aa8074ee62553b4a7bd2dc16f4cf24 # Avoid mandatory C++17.
  75. # Download latest bimg.
  76. rm -rf "${DEST}"
  77. git_clone "${DEST}" "${REPO}" "${BRANCH}" "${COMMIT}"
  78. # Cleanup bimg.
  79. rm -rf "${DEST}"/.appveyor.yml
  80. rm -rf "${DEST}"/.editorconfig
  81. rm -rf "${DEST}"/.gitattributes
  82. rm -rf "${DEST}"/.gitignore
  83. rm -rf "${DEST}"/.travis.yml
  84. rm -rf "${DEST}"/makefile
  85. rm -rf "${DEST}"/README.md
  86. git add -f "${DEST}"
  87. }
  88. update_bgfx () {
  89. local DEST=3rdparty/bgfx
  90. local REPO=https://github.com/bkaradzic/bgfx
  91. local BRANCH=master
  92. local COMMIT=c3dab115a86d41f0dedbc97b86560e2e85f22c47 # Avoid mandatory C++17.
  93. # Update bgfx's dependencies.
  94. update_bx
  95. update_bimg
  96. # Download latest bgfx.
  97. rm -rf "${DEST}"
  98. git_clone "${DEST}" "${REPO}" "${BRANCH}" "${COMMIT}"
  99. # Regenerate samples/core/shaders/common.shader.
  100. COMMON_SHADER=samples/core/shaders/common.shader
  101. rm "${COMMON_SHADER}"
  102. {
  103. echo "sampler_states = {"
  104. echo " clamp_point = {"
  105. echo " wrap_u = \"clamp\""
  106. echo " wrap_v = \"clamp\""
  107. echo " wrap_w = \"clamp\""
  108. echo " filter_min = \"point\""
  109. echo " filter_mag = \"point\""
  110. echo " }"
  111. echo ""
  112. echo " clamp_anisotropic = {"
  113. echo " wrap_u = \"clamp\""
  114. echo " wrap_v = \"clamp\""
  115. echo " wrap_w = \"clamp\""
  116. echo " filter_min = \"anisotropic\""
  117. echo " filter_mag = \"anisotropic\""
  118. echo " }"
  119. echo ""
  120. echo " mirror_point = {"
  121. echo " wrap_u = \"mirror\""
  122. echo " wrap_v = \"mirror\""
  123. echo " wrap_w = \"mirror\""
  124. echo " filter_min = \"point\""
  125. echo " filter_mag = \"point\""
  126. echo " }"
  127. echo ""
  128. echo " mirror_anisotropic = {"
  129. echo " wrap_u = \"mirror\""
  130. echo " wrap_v = \"mirror\""
  131. echo " wrap_w = \"mirror\""
  132. echo " filter_min = \"anisotropic\""
  133. echo " filter_mag = \"anisotropic\""
  134. echo " }"
  135. echo "}"
  136. echo ""
  137. echo "bgfx_shaders = {"
  138. echo " common = {"
  139. echo " code = \"\"\""
  140. sed 's/^/\t\t\t/' "${DEST}"/src/bgfx_shader.sh "${DEST}"/examples/common/shaderlib.sh
  141. echo " \"\"\""
  142. echo " }"
  143. echo "}"
  144. } >> "${COMMON_SHADER}"
  145. # Remove trailing tabs.
  146. sed -i 's/\t*$//' "${COMMON_SHADER}"
  147. # Cleanup bgfx.
  148. rm -rf "${DEST}"/.appveyor.yml
  149. rm -rf "${DEST}"/.editorconfig
  150. rm -rf "${DEST}"/.gitattributes
  151. rm -rf "${DEST}"/.github
  152. rm -rf "${DEST}"/.gitignore
  153. rm -rf "${DEST}"/.travis.yml
  154. rm -rf "${DEST}"/3rdparty/.editorconfig
  155. rm -rf "${DEST}"/3rdparty/cgltf
  156. rm -rf "${DEST}"/3rdparty/dear-imgui
  157. rm -rf "${DEST}"/3rdparty/freetype
  158. rm -rf "${DEST}"/3rdparty/glslang/build
  159. rm -rf "${DEST}"/3rdparty/glslang/build_info.py
  160. rm -rf "${DEST}"/3rdparty/glslang/license-checker.cfg
  161. rm -rf "${DEST}"/3rdparty/iconfontheaders
  162. rm -rf "${DEST}"/3rdparty/meshoptimizer
  163. rm -rf "${DEST}"/3rdparty/sdf
  164. rm -rf "${DEST}"/3rdparty/stb
  165. rm -rf "${DEST}"/bindings
  166. rm -rf "${DEST}"/CODEOWNERS
  167. rm -rf "${DEST}"/CONTRIBUTING.md
  168. rm -rf "${DEST}"/examples
  169. rm -rf "${DEST}"/makefile
  170. rm -rf "${DEST}"/README.md
  171. rm -rf "${DEST}"/scripts/bgfx-codegen.lua
  172. rm -rf "${DEST}"/scripts/bgfx.doxygen
  173. rm -rf "${DEST}"/scripts/bgfx.idl
  174. rm -rf "${DEST}"/scripts/bindings-*.lua
  175. rm -rf "${DEST}"/scripts/build.ninja
  176. rm -rf "${DEST}"/scripts/codegen.lua
  177. rm -rf "${DEST}"/scripts/doxygen.lua
  178. rm -rf "${DEST}"/scripts/geometryc.lua
  179. rm -rf "${DEST}"/scripts/geometryv.lua
  180. rm -rf "${DEST}"/scripts/idl.lua
  181. rm -rf "${DEST}"/scripts/shader-embeded.mk
  182. rm -rf "${DEST}"/scripts/shader.mk
  183. rm -rf "${DEST}"/scripts/temp.bgfx.h
  184. rm -rf "${DEST}"/scripts/temp.bgfx.idl.inl
  185. rm -rf "${DEST}"/scripts/temp.defines.h
  186. rm -rf "${DEST}"/scripts/texturev.lua
  187. rm -rf "${DEST}"/scripts/tools.mk
  188. rm -rf "${DEST}"/src/bgfx_compute.sh
  189. rm -rf "${DEST}"/src/bgfx_shader.sh
  190. rm -rf "${DEST}"/src/fs_clear0.sc
  191. rm -rf "${DEST}"/src/fs_clear1.sc
  192. rm -rf "${DEST}"/src/fs_clear2.sc
  193. rm -rf "${DEST}"/src/fs_clear3.sc
  194. rm -rf "${DEST}"/src/fs_clear4.sc
  195. rm -rf "${DEST}"/src/fs_clear5.sc
  196. rm -rf "${DEST}"/src/fs_clear6.sc
  197. rm -rf "${DEST}"/src/fs_clear7.sc
  198. rm -rf "${DEST}"/src/fs_debugfont.sc
  199. rm -rf "${DEST}"/src/makefile
  200. rm -rf "${DEST}"/src/varying.def.sc
  201. rm -rf "${DEST}"/src/vs_clear.sc
  202. rm -rf "${DEST}"/src/vs_debugfont.sc
  203. rm -rf "${DEST}"/tools/geometryc
  204. rm -rf "${DEST}"/tools/geometryv
  205. rm -rf "${DEST}"/tools/texturev
  206. rm -rf "${DEST}"/tools/bin
  207. rm -rf "${DEST}"/docs
  208. sed -i '/dofile \"texturev.lua\"/d' "${DEST}"/scripts/genie.lua
  209. sed -i '/dofile \"geometryc.lua\"/d' "${DEST}"/scripts/genie.lua
  210. sed -i '/dofile \"geometryv.lua\"/d' "${DEST}"/scripts/genie.lua
  211. # Bump affected resources versions.
  212. RESOURCE_TYPES_H=src/resource/types.h
  213. sed -Ei 's/(.*RESOURCE_VERSION_TEXTURE)(.*RESOURCE_VERSION\()([0-9]+)(.*)/echo "\1\2$((\3 + 1))\4"/ge' src/resource/types.h
  214. sed -Ei 's/(.*RESOURCE_VERSION_SHADER)(.*RESOURCE_VERSION\()([0-9]+)(.*)/echo "\1\2$((\3 + 1))\4"/ge' src/resource/types.h
  215. # Add changes and commit.
  216. git add -f "${DEST}"
  217. git add "${COMMON_SHADER}"
  218. git add "${RESOURCE_TYPES_H}"
  219. git commit -m "3rdparty: update bx, bimg and bgfx"
  220. }
  221. update_bullet () {
  222. local DEST=3rdparty/bullet3
  223. local REPO=https://github.com/bulletphysics/bullet3
  224. local BRANCH=master
  225. # Download latest bullet3.
  226. rm -rf "${DEST}"
  227. git_clone "${DEST}" "${REPO}" "${BRANCH}"
  228. # Cleanup.
  229. rm -rf "${DEST}"/.ci
  230. rm -rf "${DEST}"/.github
  231. rm -rf "${DEST}"/.gitignore
  232. rm -rf "${DEST}"/.style.yapf
  233. rm -rf "${DEST}"/.travis.yml
  234. rm -rf "${DEST}"/_clang-format
  235. rm -rf "${DEST}"/appveyor.yml
  236. rm -rf "${DEST}"/AUTHORS.txt
  237. rm -rf "${DEST}"/build3
  238. rm -rf "${DEST}"/build_cmake_pybullet_double.sh
  239. rm -rf "${DEST}"/build_visual_studio_vr_pybullet_double.bat
  240. rm -rf "${DEST}"/build_visual_studio_vr_pybullet_double_cmake.bat
  241. rm -rf "${DEST}"/build_visual_studio_vr_pybullet_double_dynamic.bat
  242. rm -rf "${DEST}"/build_visual_studio_without_pybullet_vr.bat
  243. rm -rf "${DEST}"/bullet.pc.cmake
  244. rm -rf "${DEST}"/BulletConfig.cmake.in
  245. rm -rf "${DEST}"/clang-format-all.sh
  246. rm -rf "${DEST}"/CMakeLists.txt
  247. rm -rf "${DEST}"/data
  248. rm -rf "${DEST}"/docs
  249. rm -rf "${DEST}"/Doxyfile
  250. rm -rf "${DEST}"/examples
  251. rm -rf "${DEST}"/Extras
  252. rm -rf "${DEST}"/MANIFEST.in
  253. rm -rf "${DEST}"/README.md
  254. rm -rf "${DEST}"/setup.py
  255. rm -rf "${DEST}"/src/*.cpp
  256. rm -rf "${DEST}"/src/*.h
  257. rm -rf "${DEST}"/src/.DS_Store
  258. rm -rf "${DEST}"/src/Bullet3Collision/
  259. rm -rf "${DEST}"/src/Bullet3Common
  260. rm -rf "${DEST}"/src/Bullet3Dynamics
  261. rm -rf "${DEST}"/src/Bullet3Geometry
  262. rm -rf "${DEST}"/src/Bullet3OpenCL
  263. rm -rf "${DEST}"/src/Bullet3Serialize
  264. rm -rf "${DEST}"/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
  265. rm -rf "${DEST}"/src/BulletCollision/Gimpact
  266. rm -rf "${DEST}"/src/BulletInverseDynamics
  267. rm -rf "${DEST}"/src/clew
  268. rm -rf "${DEST}"/test
  269. rm -rf "${DEST}"/UseBullet.cmake
  270. rm -rf "${DEST}"/VERSION
  271. rm -rf "${DEST}"/xcode.command
  272. find "${DEST}" -type f -name 'CMakeLists.txt' -exec rm {} +
  273. find "${DEST}" -type f -name 'premake4.lua' -exec rm {} +
  274. # Add changes and commit.
  275. git add -f "${DEST}"
  276. git commit -m "3rdparty: update bullet3"
  277. }
  278. update_openal () {
  279. local DEST=3rdparty/openal
  280. local REPO=https://github.com/kcat/openal-soft
  281. local BRANCH=master
  282. # Backup generated headers.
  283. cp "${DEST}"/config.h /tmp/config.h
  284. cp "${DEST}"/version.h /tmp/version.h
  285. cp "${DEST}"/bsinc_inc.h /tmp/bsinc_inc.h
  286. # Download latest sources.
  287. rm -rf "${DEST}"
  288. git_clone "${DEST}" "${REPO}" "${BRANCH}"
  289. # Cleanup.
  290. rm -rf "${DEST}"/.gitignore
  291. rm -rf "${DEST}"/.travis.yml
  292. rm -rf "${DEST}"/CMakeLists.txt
  293. rm -rf "${DEST}"/README.md
  294. rm -rf "${DEST}"/XCompile-Android.txt
  295. rm -rf "${DEST}"/XCompile.txt
  296. rm -rf "${DEST}"/alsoftrc.sample
  297. rm -rf "${DEST}"/appveyor.yml
  298. rm -rf "${DEST}"/build/.empty
  299. rm -rf "${DEST}"/cmake/FindALSA.cmake
  300. rm -rf "${DEST}"/cmake/FindAudioIO.cmake
  301. rm -rf "${DEST}"/cmake/FindDSound.cmake
  302. rm -rf "${DEST}"/cmake/FindFFmpeg.cmake
  303. rm -rf "${DEST}"/cmake/FindJACK.cmake
  304. rm -rf "${DEST}"/cmake/FindMySOFA.cmake
  305. rm -rf "${DEST}"/cmake/FindOSS.cmake
  306. rm -rf "${DEST}"/cmake/FindOpenSL.cmake
  307. rm -rf "${DEST}"/cmake/FindPortAudio.cmake
  308. rm -rf "${DEST}"/cmake/FindPulseAudio.cmake
  309. rm -rf "${DEST}"/cmake/FindQSA.cmake
  310. rm -rf "${DEST}"/cmake/FindSDL2.cmake
  311. rm -rf "${DEST}"/cmake/FindSDL_sound.cmake
  312. rm -rf "${DEST}"/cmake/FindSoundIO.cmake
  313. rm -rf "${DEST}"/cmake/FindWindowsSDK.cmake
  314. rm -rf "${DEST}"/config.h.in
  315. rm -rf "${DEST}"/docs/3D7.1.txt
  316. rm -rf "${DEST}"/docs/ambdec.txt
  317. rm -rf "${DEST}"/docs/ambisonics.txt
  318. rm -rf "${DEST}"/docs/env-vars.txt
  319. rm -rf "${DEST}"/docs/hrtf.txt
  320. rm -rf "${DEST}"/examples/alffplay.cpp
  321. rm -rf "${DEST}"/examples/alhrtf.c
  322. rm -rf "${DEST}"/examples/allatency.c
  323. rm -rf "${DEST}"/examples/alloopback.c
  324. rm -rf "${DEST}"/examples/almultireverb.c
  325. rm -rf "${DEST}"/examples/alplay.c
  326. rm -rf "${DEST}"/examples/alrecord.c
  327. rm -rf "${DEST}"/examples/alreverb.c
  328. rm -rf "${DEST}"/examples/alstream.c
  329. rm -rf "${DEST}"/examples/altonegen.c
  330. rm -rf "${DEST}"/examples/common/alhelpers.c
  331. rm -rf "${DEST}"/examples/common/alhelpers.h
  332. rm -rf "${DEST}"/native-tools/CMakeLists.txt
  333. rm -rf "${DEST}"/native-tools/bin2h.c
  334. rm -rf "${DEST}"/native-tools/bsincgen.c
  335. rm -rf "${DEST}"/openal.pc.in
  336. rm -rf "${DEST}"/resources/openal32.rc
  337. rm -rf "${DEST}"/resources/resource.h
  338. rm -rf "${DEST}"/resources/router.rc
  339. rm -rf "${DEST}"/resources/soft_oal.rc
  340. rm -rf "${DEST}"/router/al.cpp
  341. rm -rf "${DEST}"/router/alc.cpp
  342. rm -rf "${DEST}"/router/router.cpp
  343. rm -rf "${DEST}"/router/router.h
  344. rm -rf "${DEST}"/utils/CIAIR.def
  345. rm -rf "${DEST}"/utils/IRC_1005.def
  346. rm -rf "${DEST}"/utils/MIT_KEMAR.def
  347. rm -rf "${DEST}"/utils/MIT_KEMAR_sofa.def
  348. rm -rf "${DEST}"/utils/SCUT_KEMAR.def
  349. rm -rf "${DEST}"/utils/alsoft-config/CMakeLists.txt
  350. rm -rf "${DEST}"/utils/alsoft-config/main.cpp
  351. rm -rf "${DEST}"/utils/alsoft-config/mainwindow.cpp
  352. rm -rf "${DEST}"/utils/alsoft-config/mainwindow.h
  353. rm -rf "${DEST}"/utils/alsoft-config/mainwindow.ui
  354. rm -rf "${DEST}"/utils/alsoft-config/verstr.cpp
  355. rm -rf "${DEST}"/utils/alsoft-config/verstr.h
  356. rm -rf "${DEST}"/utils/getopt.c
  357. rm -rf "${DEST}"/utils/getopt.h
  358. rm -rf "${DEST}"/utils/makemhr/loaddef.cpp
  359. rm -rf "${DEST}"/utils/makemhr/loaddef.h
  360. rm -rf "${DEST}"/utils/makemhr/loadsofa.cpp
  361. rm -rf "${DEST}"/utils/makemhr/loadsofa.h
  362. rm -rf "${DEST}"/utils/makemhr/makemhr.cpp
  363. rm -rf "${DEST}"/utils/makemhr/makemhr.h
  364. rm -rf "${DEST}"/utils/openal-info.c
  365. rm -rf "${DEST}"/utils/sofa-info.cpp
  366. rm -rf "${DEST}"/version.cmake
  367. rm -rf "${DEST}"/version.h.in
  368. rm -rf "${DEST}"/.github
  369. # Restore generated sources.
  370. cp /tmp/config.h "${DEST}"/config.h
  371. cp /tmp/version.h "${DEST}"/version.h
  372. cp /tmp/bsinc_inc.h "${DEST}"/bsinc_inc.h
  373. # Add changes and commit.
  374. git add -f "${DEST}"
  375. git commit -m "3rdparty: update openal"
  376. echo ""
  377. echo "!!! Remember to update ALSOFT_VERSION !!!"
  378. }
  379. update_sphinx_rtd_theme () {
  380. local REPO=https://github.com/readthedocs/sphinx_rtd_theme
  381. local DEST=docs/_themes/sphinx_rtd_theme
  382. local BRANCH=master
  383. local RTD_THEME=$(mktemp -d)
  384. # Download latest sphinx_rtd_theme.
  385. git_clone "${RTD_THEME}" "${REPO}" "${BRANCH}"
  386. rm -rf "${DEST}"
  387. mv "${RTD_THEME}"/sphinx_rtd_theme "${DEST}"
  388. # Add changes and commit.
  389. git add -f "${DEST}"
  390. git commit -m "docs: update sphinx_rtd_theme"
  391. }
  392. update_sphinx_sitemap () {
  393. local REPO=https://github.com/jdillard/sphinx-sitemap
  394. local DEST=docs/_extensions/sphinx_sitemap
  395. local BRANCH=master
  396. local SITEMAP=$(mktemp -d)
  397. # Download latest sphinx_rtd_theme.
  398. git_clone "${SITEMAP}" "${REPO}" "${BRANCH}"
  399. rm -rf "${DEST}"
  400. mv "${SITEMAP}"/sphinx_sitemap "${DEST}"
  401. # Add changes and commit.
  402. git add -f "${DEST}"
  403. git commit -m "docs: update sphinx-sitemap"
  404. }
  405. update_sphinx_lubg () {
  406. local REPO=https://github.com/mgeier/sphinx-last-updated-by-git/
  407. local DEST=docs/_extensions/sphinx_last_updated_by_git.py
  408. local BRANCH=master
  409. local LUBG=$(mktemp -d)
  410. # Download latest sphinx_rtd_theme.
  411. git_clone "${LUBG}" "${REPO}" "${BRANCH}"
  412. rm -rf "${DEST}"
  413. mv "${LUBG}"/src/sphinx_last_updated_by_git.py "${DEST}"
  414. # Add changes and commit.
  415. git add -f "${DEST}"
  416. git commit -m "docs: update sphinx-last-updated-by-git"
  417. }
  418. update_sphinx_opengraph () {
  419. local REPO=https://github.com/sphinx-doc/sphinxext-opengraph
  420. local DEST=docs/_extensions/sphinxext/opengraph
  421. local BRANCH=master
  422. local OPENGRAPH=$(mktemp -d)
  423. # Download latest sphinx_rtd_theme.
  424. git_clone "${OPENGRAPH}" "${REPO}" "${BRANCH}"
  425. rm -rf "${DEST}"
  426. mv "${OPENGRAPH}"/sphinxext/opengraph "${DEST}"
  427. # Add changes and commit.
  428. git add -f "${DEST}"
  429. git commit -m "docs: update sphinxext-opengraph"
  430. }
  431. update_gtk_theme () {
  432. local REPO=https://gitlab.gnome.org/GNOME/gtk.git
  433. local DEST=tools/level_editor/resources/theme/Adwaita
  434. local BRANCH=gtk-3-24
  435. local GTK_THEME=$(mktemp -d)
  436. # Download latest sphinx_rtd_theme.
  437. git_clone "${GTK_THEME}" "${REPO}" "${BRANCH}"
  438. rm -rf "${DEST}"
  439. mv "${GTK_THEME}"/gtk/theme/Adwaita "${DEST}"
  440. sed -i 's/resource:\/\/\/org\/gtk\/libgtk\/theme\/Adwaita\/gtk-contained.css/resource:\/\/\/org\/crown\/level_editor\/theme\/Adwaita\/gtk-contained.css/' "${DEST}"/gtk.css
  441. sed -i 's/resource:\/\/\/org\/gtk\/libgtk\/theme\/Adwaita\/gtk-contained-dark.css/resource:\/\/\/org\/crown\/level_editor\/theme\/Adwaita\/gtk-contained-dark.css/' "${DEST}"/gtk-dark.css
  442. # Add changes and commit.
  443. git add -f "${DEST}"
  444. git commit -m "tools: update GTK theme"
  445. }
  446. update_tinyexpr () {
  447. # Download latest tinyexpr.
  448. local REPO=https://github.com/codeplea/tinyexpr
  449. local DEST=3rdparty/tinyexpr
  450. local BRANCH=master
  451. rm -rf "${DEST}"
  452. git_clone "${DEST}" "${REPO}" "${BRANCH}"
  453. # Cleanup.
  454. rm -r "${DEST}"/doc
  455. rm "${DEST}"/benchmark.c
  456. rm "${DEST}"/CONTRIBUTING
  457. rm "${DEST}"/example2.c
  458. rm "${DEST}"/example3.c
  459. rm "${DEST}"/example.c
  460. rm "${DEST}"/Makefile
  461. rm "${DEST}"/minctest.h
  462. rm "${DEST}"/README.md
  463. rm "${DEST}"/repl.c
  464. rm "${DEST}"/smoke.c
  465. rm "${DEST}"/.travis.yml
  466. # Add changes and commit.
  467. git add -f "${DEST}"
  468. git commit -m "3rdparty: update tinyexpr"
  469. }
  470. update_ufbx () {
  471. # Download latest tinyexpr.
  472. local REPO=https://github.com/ufbx/ufbx
  473. local DEST=3rdparty/ufbx
  474. local BRANCH=v0.20.0
  475. rm -rf "${DEST}"
  476. git_clone "${DEST}" "${REPO}" "${BRANCH}"
  477. # Cleanup.
  478. rm -r "${DEST}"/.git
  479. rm -r "${DEST}"/.github
  480. rm -r "${DEST}"/bindgen
  481. rm -r "${DEST}"/data
  482. rm -r "${DEST}"/examples
  483. rm -r "${DEST}"/extra
  484. rm -r "${DEST}"/misc
  485. rm -r "${DEST}"/test
  486. rm "${DEST}"/.gitattributes
  487. rm "${DEST}"/.gitignore
  488. rm "${DEST}"/README.md
  489. # Add changes and commit.
  490. git add -f "${DEST}"
  491. git commit -m "3rdparty: update ufbx"
  492. }
  493. update_stb () {
  494. # Download latest stb libs.
  495. local REPO=https://github.com/nothings/stb
  496. local DEST=3rdparty/stb
  497. local BRANCH=master
  498. rm -rf "${DEST}"
  499. git_clone "${DEST}" "${REPO}" "${BRANCH}"
  500. # Cleanup.
  501. rm -r "${DEST}"/.git
  502. rm -r "${DEST}"/.github
  503. rm -r "${DEST}"/data
  504. rm -r "${DEST}"/deprecated
  505. rm -r "${DEST}"/docs
  506. rm -r "${DEST}"/stb_image_resize_test
  507. rm -r "${DEST}"/tests
  508. rm -r "${DEST}"/tools
  509. rm "${DEST}"/.gitignore
  510. rm "${DEST}"/.travis.yml
  511. rm "${DEST}"/.gitignore
  512. rm "${DEST}"/README.md
  513. rm "${DEST}"/stb_c_lexer.h
  514. rm "${DEST}"/stb_connected_components.h
  515. rm "${DEST}"/stb_divide.h
  516. rm "${DEST}"/stb_ds.h
  517. rm "${DEST}"/stb_dxt.h
  518. rm "${DEST}"/stb_easy_font.h
  519. rm "${DEST}"/stb_herringbone_wang_tile.h
  520. rm "${DEST}"/stb_hexwave.h
  521. rm "${DEST}"/stb_image.h
  522. rm "${DEST}"/stb_image_resize2.h
  523. rm "${DEST}"/stb_image_write.h
  524. rm "${DEST}"/stb_include.h
  525. rm "${DEST}"/stb_leakcheck.h
  526. rm "${DEST}"/stb_perlin.h
  527. rm "${DEST}"/stb_textedit.h
  528. rm "${DEST}"/stb_tilemap_editor.h
  529. rm "${DEST}"/stb_voxel_render.h
  530. # Add changes and commit.
  531. git add -f "${DEST}"
  532. git commit -m "3rdparty: update stb"
  533. }
  534. print_help () {
  535. echo "Usage: scripts/upgrade.sh <dependency-name>"
  536. }
  537. while true; do
  538. case "$1" in
  539. luajit)
  540. update_luajit
  541. exit $?
  542. ;;
  543. bgfx)
  544. update_bgfx
  545. exit $?
  546. ;;
  547. bullet)
  548. update_bullet
  549. exit $?
  550. ;;
  551. openal)
  552. update_openal
  553. exit $?
  554. ;;
  555. sphinx_rtd_theme)
  556. update_sphinx_rtd_theme
  557. exit $?
  558. ;;
  559. sphinx_sitemap)
  560. update_sphinx_sitemap
  561. exit $?
  562. ;;
  563. sphinx_lubg)
  564. update_sphinx_lubg
  565. exit $?
  566. ;;
  567. sphinx_opengraph)
  568. update_sphinx_opengraph
  569. exit $?
  570. ;;
  571. tinyexpr)
  572. update_tinyexpr
  573. exit $?
  574. ;;
  575. gtk_theme)
  576. update_gtk_theme
  577. exit $?
  578. ;;
  579. ufbx)
  580. update_ufbx
  581. exit $?
  582. ;;
  583. stb)
  584. update_stb
  585. exit $?
  586. ;;
  587. *)
  588. echo "Unknown option or target \`$1\`"
  589. print_help
  590. exit 1
  591. ;;
  592. esac
  593. done