installer.nsi 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. ; Panda3D installation script for the Nullsoft Installation System (NSIS).
  2. ; Jon Parise <[email protected]>
  3. ; with Ben Johnson <[email protected]>
  4. ; with Jason Pratt <[email protected]>
  5. ; mangled by Josh Yelon <[email protected]>
  6. ; Heavily restructured by rdb
  7. ; Caller needs to define these variables:
  8. ;
  9. ; COMPRESSOR - either zlib or lzma
  10. ; TITLE - title (eg. "Panda3D SDK 1.9.0")
  11. ; INSTALLDIR - default install location (eg. "C:\Panda3D-1.9.0-x64")
  12. ; OUTFILE - where to put the output file (eg. "..\nsis-output.exe")
  13. ;
  14. ; BUILT - location of panda install tree.
  15. ; SOURCE - location of the panda source-tree if available, OR location of panda install tree.
  16. ; INCLUDE_PYVER - version of Python that Panda was built with (eg. "2.7", "3.5-32")
  17. ; REGVIEW - either 32 or 64, depending on the build architecture.
  18. ;
  19. Name "${TITLE}"
  20. InstallDir "${INSTALLDIR}"
  21. OutFile "${OUTFILE}"
  22. RequestExecutionLevel user
  23. SetCompress auto
  24. SetCompressor ${COMPRESSOR}
  25. !include "MUI2.nsh"
  26. !include "Sections.nsh"
  27. !include "WinMessages.nsh"
  28. !include "WordFunc.nsh"
  29. !include "x64.nsh"
  30. !define MUI_WELCOMEFINISHPAGE_BITMAP "panda-install.bmp"
  31. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "panda-install.bmp"
  32. !define MUI_ABORTWARNING
  33. !define MUI_FINISHPAGE_NOREBOOTSUPPORT
  34. !define MUI_FINISHPAGE_RUN
  35. !define MUI_FINISHPAGE_RUN_FUNCTION runFunction
  36. !define MUI_FINISHPAGE_RUN_TEXT "Visit the Panda3D Manual"
  37. !insertmacro MUI_PAGE_WELCOME
  38. !insertmacro MUI_PAGE_LICENSE "${SOURCE}/doc/LICENSE"
  39. !insertmacro MUI_PAGE_DIRECTORY
  40. !ifdef INCLUDE_PYVER
  41. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE ConfirmPythonSelection
  42. !endif
  43. !insertmacro MUI_PAGE_COMPONENTS
  44. !insertmacro MUI_PAGE_INSTFILES
  45. !insertmacro MUI_PAGE_FINISH
  46. !insertmacro MUI_UNPAGE_WELCOME
  47. !insertmacro MUI_UNPAGE_CONFIRM
  48. !insertmacro MUI_UNPAGE_INSTFILES
  49. !insertmacro MUI_UNPAGE_FINISH
  50. !insertmacro MUI_LANGUAGE "English"
  51. ShowInstDetails hide
  52. ShowUninstDetails hide
  53. LicenseData "${SOURCE}/doc/LICENSE"
  54. InstType "Auto (Recommended)"
  55. InstType "Full"
  56. InstType "Light"
  57. LangString DESC_SecCore ${LANG_ENGLISH} "The Panda3D core libraries, configuration files and models/textures that are needed to use Panda3D."
  58. LangString DESC_SecOpenGL ${LANG_ENGLISH} "The OpenGL graphics back-end is the most well-supported renderer."
  59. LangString DESC_SecDirect3D9 ${LANG_ENGLISH} "The optional Direct3D 9 renderer."
  60. LangString DESC_SecOpenAL ${LANG_ENGLISH} "Support for playing audio via the OpenAL library. You need either OpenAL or FMOD to be able to play audio."
  61. LangString DESC_SecFMOD ${LANG_ENGLISH} "Support for decoding and playing audio via the FMOD Ex library. You need either OpenAL or FMOD to be able to play audio."
  62. LangString DESC_SecFFMpeg ${LANG_ENGLISH} "Support for decoding video and audio via the FFMpeg library. Without this option, Panda3D will only be able to play .wav and .ogg audio files."
  63. LangString DESC_SecBullet ${LANG_ENGLISH} "Support for the Bullet physics engine."
  64. LangString DESC_SecODE ${LANG_ENGLISH} "Support for the Open Dynamics Engine to implement physics."
  65. LangString DESC_SecPhysX ${LANG_ENGLISH} "Support for NVIDIA PhysX to implement physics."
  66. LangString DESC_SecRocket ${LANG_ENGLISH} "Support for the libRocket GUI library. This is an optional library that offers an HTML/CSS-like approach to creating user interfaces."
  67. LangString DESC_SecTools ${LANG_ENGLISH} "Useful tools and model converters to help with Panda3D development. Recommended."
  68. LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D."
  69. LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings."
  70. LangString DESC_SecPython ${LANG_ENGLISH} "Contains a ${REGVIEW}-bit copy of Python ${INCLUDE_PYVER} preconfigured to make use of Panda3D."
  71. LangString DESC_SecHeadersLibs ${LANG_ENGLISH} "Headers and libraries needed for C++ development with Panda3D."
  72. LangString DESC_SecSamples ${LANG_ENGLISH} "The sample programs demonstrate how to make Python applications with Panda3D."
  73. LangString DESC_SecMaxPlugins ${LANG_ENGLISH} "Plug-ins for Autodesk 3ds Max (${REGVIEW}-bit) that can be used to export models to Panda3D."
  74. LangString DESC_SecMayaPlugins ${LANG_ENGLISH} "Plug-ins and scripts for Autodesk Maya (${REGVIEW}-bit) that can be used to export models to Panda3D."
  75. var READABLE
  76. var MANPAGE
  77. ; See http://nsis.sourceforge.net/Check_if_a_file_exists_at_compile_time for documentation
  78. !macro !defineifexist _VAR_NAME _FILE_NAME
  79. !tempfile _TEMPFILE
  80. !ifdef NSIS_WIN32_MAKENSIS
  81. ; Windows - cmd.exe
  82. !system 'if exist "${_FILE_NAME}" echo !define ${_VAR_NAME} > "${_TEMPFILE}"'
  83. !else
  84. ; Posix - sh
  85. !system 'if [ -e "${_FILE_NAME}" ]; then echo "!define ${_VAR_NAME}" > "${_TEMPFILE}"; fi'
  86. !endif
  87. !include '${_TEMPFILE}'
  88. !delfile '${_TEMPFILE}'
  89. !undef _TEMPFILE
  90. !macroend
  91. !insertmacro !defineifexist HAVE_GL "${BUILT}\bin\libpandagl.dll"
  92. !insertmacro !defineifexist HAVE_DX9 "${BUILT}\bin\libpandadx9.dll"
  93. !insertmacro !defineifexist HAVE_OPENAL "${BUILT}\bin\libp3openal_audio.dll"
  94. !insertmacro !defineifexist HAVE_FMOD "${BUILT}\bin\libp3fmod_audio.dll"
  95. !insertmacro !defineifexist HAVE_FFMPEG "${BUILT}\bin\libp3ffmpeg.dll"
  96. !insertmacro !defineifexist HAVE_BULLET "${BUILT}\bin\libpandabullet.dll"
  97. !insertmacro !defineifexist HAVE_ODE "${BUILT}\bin\libpandaode.dll"
  98. !insertmacro !defineifexist HAVE_PHYSX "${BUILT}\bin\libpandaphysx.dll"
  99. !insertmacro !defineifexist HAVE_ROCKET "${BUILT}\bin\libp3rocket.dll"
  100. !insertmacro !defineifexist HAVE_SAMPLES "${SOURCE}\samples"
  101. !insertmacro !defineifexist HAVE_MAX_PLUGINS "${BUILT}\plugins\*.dlo"
  102. !insertmacro !defineifexist HAVE_MAYA_PLUGINS "${BUILT}\plugins\*.mll"
  103. !macro RemovePythonPath PYVER
  104. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" ""
  105. StrCmp $0 "$INSTDIR" 0 +2
  106. DeleteRegKey HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D"
  107. !macroend
  108. !macro PyBindingSection PYVER EXT_SUFFIX
  109. LangString DESC_SecPyBindings${PYVER} ${LANG_ENGLISH} "Contains the Python modules that allow use of Panda3D using a ${REGVIEW}-bit version of Python ${PYVER}."
  110. !insertmacro !defineifexist _present "${BUILT}\panda3d\core${EXT_SUFFIX}"
  111. !ifdef _present
  112. Section "${PYVER} bindings" SecPyBindings${PYVER}
  113. !if "${PYVER}" == "${INCLUDE_PYVER}"
  114. SectionIn 1 2 3
  115. !else
  116. !if "${PYVER}" == "2.7"
  117. SectionIn 1 2
  118. !else
  119. ; See .onInit function where this is dynamically enabled.
  120. SectionIn 2
  121. !endif
  122. !endif
  123. SetDetailsPrint both
  124. DetailPrint "Installing Panda3D bindings for Python ${PYVER}..."
  125. SetDetailsPrint listonly
  126. SetOutPath $INSTDIR\panda3d
  127. File /nonfatal /r "${BUILT}\panda3d\core${EXT_SUFFIX}"
  128. File /nonfatal /r "${BUILT}\panda3d\ai${EXT_SUFFIX}"
  129. File /nonfatal /r "${BUILT}\panda3d\direct${EXT_SUFFIX}"
  130. File /nonfatal /r "${BUILT}\panda3d\egg${EXT_SUFFIX}"
  131. File /nonfatal /r "${BUILT}\panda3d\fx${EXT_SUFFIX}"
  132. File /nonfatal /r "${BUILT}\panda3d\interrogatedb${EXT_SUFFIX}"
  133. File /nonfatal /r "${BUILT}\panda3d\physics${EXT_SUFFIX}"
  134. File /nonfatal /r "${BUILT}\panda3d\_rplight${EXT_SUFFIX}"
  135. File /nonfatal /r "${BUILT}\panda3d\skel${EXT_SUFFIX}"
  136. File /nonfatal /r "${BUILT}\panda3d\vision${EXT_SUFFIX}"
  137. File /nonfatal /r "${BUILT}\panda3d\vrpn${EXT_SUFFIX}"
  138. !ifdef HAVE_BULLET
  139. SectionGetFlags ${SecBullet} $R0
  140. IntOp $R0 $R0 & ${SF_SELECTED}
  141. StrCmp $R0 ${SF_SELECTED} 0 SkipBulletPyd
  142. File /nonfatal /r "${BUILT}\panda3d\bullet${EXT_SUFFIX}"
  143. SkipBulletPyd:
  144. !endif
  145. !ifdef HAVE_ODE
  146. SectionGetFlags ${SecODE} $R0
  147. IntOp $R0 $R0 & ${SF_SELECTED}
  148. StrCmp $R0 ${SF_SELECTED} 0 SkipODEPyd
  149. File /nonfatal /r "${BUILT}\panda3d\ode${EXT_SUFFIX}"
  150. SkipODEPyd:
  151. !endif
  152. !ifdef HAVE_PHYSX
  153. SectionGetFlags ${SecPhysX} $R0
  154. IntOp $R0 $R0 & ${SF_SELECTED}
  155. StrCmp $R0 ${SF_SELECTED} 0 SkipPhysXPyd
  156. File /nonfatal /r "${BUILT}\panda3d\physx${EXT_SUFFIX}"
  157. SkipPhysXPyd:
  158. !endif
  159. !ifdef HAVE_ROCKET
  160. SectionGetFlags ${SecRocket} $R0
  161. IntOp $R0 $R0 & ${SF_SELECTED}
  162. StrCmp $R0 ${SF_SELECTED} 0 SkipRocketPyd
  163. File /nonfatal /r "${BUILT}\panda3d\rocket${EXT_SUFFIX}"
  164. SkipRocketPyd:
  165. !endif
  166. SetOutPath $INSTDIR\pandac\input
  167. File /r "${BUILT}\pandac\input\*"
  168. SetOutPath $INSTDIR\Pmw
  169. File /nonfatal /r /x CVS "${BUILT}\Pmw\*"
  170. SetOutPath $INSTDIR\panda3d.dist-info
  171. File /nonfatal /r "${BUILT}\panda3d.dist-info\*"
  172. !ifdef REGVIEW
  173. SetRegView ${REGVIEW}
  174. !endif
  175. ; Install a Panda3D path into the global PythonPath for this version
  176. ; of Python.
  177. WriteRegStr HKCU "Software\Python\PythonCore\${PYVER}\PythonPath\Panda3D" "" "$INSTDIR"
  178. SectionEnd
  179. !undef _present
  180. !endif
  181. !macroend
  182. Function runFunction
  183. ExecShell "open" "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk"
  184. FunctionEnd
  185. SectionGroup "Panda3D Libraries"
  186. Section "Core Libraries" SecCore
  187. SectionIn 1 2 3 RO
  188. SetShellVarContext current
  189. SetOverwrite try
  190. SetDetailsPrint both
  191. DetailPrint "Installing Panda3D libraries..."
  192. SetDetailsPrint listonly
  193. SetOutPath "$INSTDIR"
  194. File /nonfatal "${BUILT}\LICENSE"
  195. File /nonfatal "${BUILT}\ReleaseNotes"
  196. File /nonfatal "${BUILT}\pandaIcon.ico"
  197. SetOutPath $INSTDIR\etc
  198. File /r "${BUILT}\etc\*"
  199. SetOutPath $INSTDIR\bin
  200. File /r /x api-ms-win-*.dll /x ucrtbase.dll /x libpandagl.dll /x libpandadx9.dll /x cgD3D*.dll /x python*.dll /x libpandaode.dll /x libp3fmod_audio.dll /x fmodex*.dll /x libp3ffmpeg.dll /x av*.dll /x postproc*.dll /x swscale*.dll /x swresample*.dll /x NxCharacter*.dll /x cudart*.dll /x PhysX*.dll /x libpandaphysx.dll /x libp3rocket.dll /x boost_python*.dll /x Rocket*.dll /x _rocket*.pyd /x libpandabullet.dll /x OpenAL32.dll /x *_oal.dll /x libp3openal_audio.dll "${BUILT}\bin\*.dll"
  201. File /nonfatal /r "${BUILT}\bin\Microsoft.*.manifest"
  202. ; Before Windows 10, we need these stubs for the UCRT as well.
  203. ReadRegDWORD $0 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentMajorVersionNumber"
  204. ${If} $0 < 10
  205. ClearErrors
  206. File /nonfatal /r "${BUILT}\bin\api-ms-win-*.dll"
  207. File /nonfatal "${BUILT}\bin\ucrtbase.dll"
  208. ${Endif}
  209. SetDetailsPrint both
  210. DetailPrint "Installing models..."
  211. SetDetailsPrint listonly
  212. SetOutPath $INSTDIR\models
  213. File /r /x CVS "${BUILT}\models\*"
  214. SetDetailsPrint both
  215. DetailPrint "Installing optional components..."
  216. SetDetailsPrint listonly
  217. RMDir /r "$SMPROGRAMS\${TITLE}"
  218. CreateDirectory "$SMPROGRAMS\${TITLE}"
  219. SectionEnd
  220. !ifdef HAVE_GL
  221. Section "OpenGL" SecOpenGL
  222. SectionIn 1 2 3 RO
  223. SetOutPath "$INSTDIR\bin"
  224. File "${BUILT}\bin\libpandagl.dll"
  225. SectionEnd
  226. !endif
  227. !ifdef HAVE_DX9
  228. Section "Direct3D 9" SecDirect3D9
  229. SectionIn 1 2
  230. SetOutPath "$INSTDIR\bin"
  231. File "${BUILT}\bin\libpandadx9.dll"
  232. File /nonfatal /r "${BUILT}\bin\cgD3D9.dll"
  233. SectionEnd
  234. !endif
  235. !ifdef HAVE_OPENAL
  236. Section "OpenAL Audio" SecOpenAL
  237. SectionIn 1 2 3
  238. SetOutPath "$INSTDIR\bin"
  239. File "${BUILT}\bin\libp3openal_audio.dll"
  240. File /nonfatal /r "${BUILT}\bin\OpenAL32.dll"
  241. File /nonfatal /r "${BUILT}\bin\*_oal.dll"
  242. SectionEnd
  243. !endif
  244. !ifdef HAVE_FMOD
  245. Section "FMOD Audio" SecFMOD
  246. SectionIn 1 2
  247. SetOutPath "$INSTDIR\bin"
  248. File "${BUILT}\bin\libp3fmod_audio.dll"
  249. File /r "${BUILT}\bin\fmodex*.dll"
  250. SectionEnd
  251. !endif
  252. !ifdef HAVE_FFMPEG
  253. Section "FFMpeg" SecFFMpeg
  254. SectionIn 1 2
  255. SetOutPath "$INSTDIR\bin"
  256. File "${BUILT}\bin\libp3ffmpeg.dll"
  257. File /nonfatal /r "${BUILT}\bin\av*.dll"
  258. File /nonfatal /r "${BUILT}\bin\swscale*.dll"
  259. File /nonfatal /r "${BUILT}\bin\swresample*.dll"
  260. File /nonfatal /r "${BUILT}\bin\postproc*.dll"
  261. SectionEnd
  262. !endif
  263. !ifdef HAVE_BULLET
  264. Section "Bullet Physics" SecBullet
  265. SectionIn 1 2
  266. SetOutPath "$INSTDIR\bin"
  267. File "${BUILT}\bin\libpandabullet.dll"
  268. SectionEnd
  269. !endif
  270. !ifdef HAVE_ODE
  271. Section "ODE Physics" SecODE
  272. SectionIn 1 2
  273. SetOutPath "$INSTDIR\bin"
  274. File "${BUILT}\bin\libpandaode.dll"
  275. SectionEnd
  276. !endif
  277. !ifdef HAVE_PHYSX
  278. Section "NVIDIA PhysX" SecPhysX
  279. ; Only enable in "Full"
  280. SectionIn 2
  281. SetOutPath "$INSTDIR\bin"
  282. File "${BUILT}\bin\libpandaphysx.dll"
  283. File /nonfatal /r "${BUILT}\bin\PhysX*.dll"
  284. File /nonfatal /r "${BUILT}\bin\NxCharacter*.dll"
  285. File /nonfatal /r "${BUILT}\bin\cudart*.dll"
  286. SectionEnd
  287. !endif
  288. !ifdef HAVE_ROCKET
  289. Section "libRocket GUI" SecRocket
  290. SectionIn 1 2
  291. SetOutPath "$INSTDIR\bin"
  292. File "${BUILT}\bin\libp3rocket.dll"
  293. File /nonfatal /r "${BUILT}\bin\Rocket*.dll"
  294. File /nonfatal /r "${BUILT}\bin\_rocket*.pyd"
  295. File /nonfatal /r "${BUILT}\bin\boost_python*.dll"
  296. SectionEnd
  297. !endif
  298. SectionGroupEnd
  299. Section "Tools and utilities" SecTools
  300. SectionIn 1 2 3
  301. SetDetailsPrint both
  302. DetailPrint "Installing utilities..."
  303. SetDetailsPrint listonly
  304. SetOutPath "$INSTDIR\bin"
  305. File /r /x deploy-stub.exe /x deploy-stubw.exe "${BUILT}\bin\*.exe"
  306. File /nonfatal /r "${BUILT}\bin\*.p3d"
  307. SetOutPath "$INSTDIR\NSIS"
  308. File /r /x CVS "${NSISDIR}\*"
  309. WriteRegStr HKCU "Software\Classes\Panda3D.Model" "" "Panda3D model/animation"
  310. WriteRegStr HKCU "Software\Classes\Panda3D.Model\DefaultIcon" "" "$INSTDIR\bin\pview.exe"
  311. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell" "" "open"
  312. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"'
  313. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress" "" "Compress to .pz"
  314. WriteRegStr HKCU "Software\Classes\Panda3D.Model\shell\compress\command" "" '"$INSTDIR\bin\pzip.exe" "%1"'
  315. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed" "" "Compressed file"
  316. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" "" "$INSTDIR\bin\pzip.exe"
  317. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell" "" "open"
  318. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\open\command" "" '"$INSTDIR\bin\pview.exe" -l "%1"'
  319. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress" "" "Decompress"
  320. WriteRegStr HKCU "Software\Classes\Panda3D.Compressed\shell\decompress\command" "" '"$INSTDIR\bin\punzip.exe" "%1"'
  321. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile" "" "Panda3D Multifile"
  322. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" "" "$INSTDIR\bin\multify.exe"
  323. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell" "" "open"
  324. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract" "" "Extract here"
  325. WriteRegStr HKCU "Software\Classes\Panda3D.Multifile\shell\extract\command" "" '"$INSTDIR\bin\multify.exe" -xf "%1"'
  326. SectionEnd
  327. SectionGroup "Python modules" SecGroupPython
  328. Section "Shared code" SecPyShared
  329. SectionIn 1 2 3
  330. SetDetailsPrint both
  331. DetailPrint "Installing Panda3D shared Python modules..."
  332. SetDetailsPrint listonly
  333. SetOutPath $INSTDIR\direct\directscripts
  334. File /r /x CVS /x Opt?-Win32 "${BUILT}\direct\directscripts\*"
  335. SetOutPath $INSTDIR\direct
  336. File /r /x CVS /x Opt?-Win32 "${BUILT}\direct\*.py"
  337. Delete "$INSTDIR\panda3d.py"
  338. Delete "$INSTDIR\panda3d.pyc"
  339. Delete "$INSTDIR\panda3d.pyo"
  340. SetOutPath $INSTDIR\pandac
  341. File /r "${BUILT}\pandac\*.py"
  342. SetOutPath $INSTDIR\panda3d
  343. File /r "${BUILT}\panda3d\*.py"
  344. SectionEnd
  345. !insertmacro PyBindingSection 2.7 .pyd
  346. !if "${REGVIEW}" == "32"
  347. !insertmacro PyBindingSection 3.5-32 .cp35-win32.pyd
  348. !insertmacro PyBindingSection 3.6-32 .cp36-win32.pyd
  349. !insertmacro PyBindingSection 3.7-32 .cp37-win32.pyd
  350. !insertmacro PyBindingSection 3.8-32 .cp38-win32.pyd
  351. !insertmacro PyBindingSection 3.9-32 .cp39-win32.pyd
  352. !else
  353. !insertmacro PyBindingSection 3.5 .cp35-win_amd64.pyd
  354. !insertmacro PyBindingSection 3.6 .cp36-win_amd64.pyd
  355. !insertmacro PyBindingSection 3.7 .cp37-win_amd64.pyd
  356. !insertmacro PyBindingSection 3.8 .cp38-win_amd64.pyd
  357. !insertmacro PyBindingSection 3.9 .cp39-win_amd64.pyd
  358. !endif
  359. SectionGroupEnd
  360. !ifdef INCLUDE_PYVER
  361. Section "Python ${INCLUDE_PYVER}" SecPython
  362. SectionIn 1 2 3
  363. !ifdef REGVIEW
  364. SetRegView ${REGVIEW}
  365. !endif
  366. SetDetailsPrint both
  367. DetailPrint "Installing Python ${INCLUDE_PYVER} interpreter (${REGVIEW}-bit)..."
  368. SetDetailsPrint listonly
  369. SetOutPath "$INSTDIR\bin"
  370. File /nonfatal "${BUILT}\bin\python*.dll"
  371. SetOutPath "$INSTDIR\python"
  372. File /r /x *.pdb "${BUILT}\python\*"
  373. SetDetailsPrint both
  374. DetailPrint "Adding registry keys for Python..."
  375. SetDetailsPrint listonly
  376. ; Check if a copy of Python is installed for this user.
  377. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  378. StrCmp "$0" "$INSTDIR\python" RegPath 0
  379. StrCmp "$0" "" SkipFileCheck 0
  380. IfFileExists "$0\python.exe" AskRegPath 0
  381. SkipFileCheck:
  382. ; Check if a system-wide copy of Python is installed.
  383. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  384. StrCmp "$0" "$INSTDIR\python" RegPath 0
  385. StrCmp "$0" "" RegPath 0
  386. IfFileExists "$0\python.exe" AskRegPath RegPath
  387. AskRegPath:
  388. MessageBox MB_YESNO|MB_ICONQUESTION \
  389. "You already have a copy of Python ${INCLUDE_PYVER} installed in:$\r$\n$0$\r$\n$\r$\nPanda3D installs its own copy of Python ${INCLUDE_PYVER}, which will install alongside your existing copy. Would you like to make Panda's copy the default Python for your user account?" \
  390. IDNO SkipRegPath
  391. RegPath:
  392. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "" "$INSTDIR\python"
  393. WriteRegStr HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" "ExecutablePath" "$INSTDIR\python\python.exe"
  394. SkipRegPath:
  395. SectionEnd
  396. !endif
  397. !macro MaybeEnablePyBindingSection PYVER
  398. !if "${INCLUDE_PYVER}" != "${PYVER}"
  399. !ifdef SecPyBindings${PYVER}
  400. ; Check if a copy of Python is installed for this user.
  401. Push $0
  402. ReadRegStr $0 HKCU "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  403. StrCmp "$0" "" +2 0
  404. IfFileExists "$0\python.exe" Py${PYVER}Exists 0
  405. ; Check if a system-wide copy of Python is installed.
  406. ReadRegStr $0 HKLM "Software\Python\PythonCore\${PYVER}\InstallPath" ""
  407. StrCmp "$0" "" Py${PYVER}ExistsNot 0
  408. IfFileExists "$0\python.exe" Py${PYVER}Exists Py${PYVER}ExistsNot
  409. Py${PYVER}Exists:
  410. SectionSetFlags ${SecPyBindings${PYVER}} ${SF_SELECTED}
  411. SectionSetInstTypes ${SecPyBindings${PYVER}} 3
  412. Py${PYVER}ExistsNot:
  413. Pop $0
  414. !endif
  415. !endif
  416. !macroend
  417. Function .onInit
  418. ${If} ${REGVIEW} = 64
  419. ${AndIfNot} ${RunningX64}
  420. MessageBox MB_OK|MB_ICONEXCLAMATION "You are attempting to install the 64-bit version of Panda3D on a 32-bit version of Windows. Please download and install the 32-bit version of Panda3D instead."
  421. Abort
  422. ${EndIf}
  423. !ifdef REGVIEW
  424. SetRegView ${REGVIEW}
  425. !endif
  426. ; We never check for 2.7; it is always enabled in Auto mode
  427. !if "${REGVIEW}" == "32"
  428. !insertmacro MaybeEnablePyBindingSection 3.5-32
  429. !insertmacro MaybeEnablePyBindingSection 3.6-32
  430. !insertmacro MaybeEnablePyBindingSection 3.7-32
  431. !insertmacro MaybeEnablePyBindingSection 3.8-32
  432. !insertmacro MaybeEnablePyBindingSection 3.9-32
  433. !else
  434. !insertmacro MaybeEnablePyBindingSection 3.5
  435. !insertmacro MaybeEnablePyBindingSection 3.6
  436. !insertmacro MaybeEnablePyBindingSection 3.7
  437. !insertmacro MaybeEnablePyBindingSection 3.8
  438. !insertmacro MaybeEnablePyBindingSection 3.9
  439. !endif
  440. FunctionEnd
  441. Function .onSelChange
  442. ; If someone selects any Python version, the "shared modules" must be on.
  443. ${If} ${SectionIsPartiallySelected} ${SecGroupPython}
  444. SectionGetFlags ${SecPyShared} $R0
  445. IntOp $R0 $R0 | ${SF_SELECTED}
  446. SectionSetFlags ${SecPyShared} $R0
  447. ${EndIf}
  448. FunctionEnd
  449. !ifdef INCLUDE_PYVER
  450. Function ConfirmPythonSelection
  451. ; Check the current state of the "Python" section selection.
  452. SectionGetFlags ${SecPython} $R0
  453. IntOp $R1 $R0 & ${SF_SELECTED}
  454. ; Is the "Python" selection deselected?
  455. StrCmp $R1 ${SF_SELECTED} SkipCheck 0
  456. ; Maybe the user just doesn't want Python support at all?
  457. !insertmacro SectionFlagIsSet ${SecGroupPython} ${SF_PSELECTED} 0 SkipCheck
  458. !ifdef REGVIEW
  459. SetRegView ${REGVIEW}
  460. !endif
  461. ; Check for a user installation of Python.
  462. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  463. StrCmp $0 "$INSTDIR\python" CheckSystemWidePython 0
  464. StrCmp $0 "" CheckSystemWidePython 0
  465. IfFileExists "$0\ppython.exe" CheckSystemWidePython 0
  466. IfFileExists "$0\python.exe" SkipCheck CheckSystemWidePython
  467. ; Check for a system-wide Python installation.
  468. CheckSystemWidePython:
  469. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  470. StrCmp $0 "$INSTDIR\python" AskConfirmation 0
  471. StrCmp $0 "" AskConfirmation 0
  472. IfFileExists "$0\ppython.exe" AskConfirmation 0
  473. IfFileExists "$0\python.exe" SkipCheck AskConfirmation
  474. ; No compatible Python version found (that wasn't shipped as part
  475. ; of a different Panda3D build.) Ask the user if he's sure about this.
  476. AskConfirmation:
  477. MessageBox MB_YESNO|MB_ICONQUESTION \
  478. "You do not appear to have a ${REGVIEW}-bit version of Python ${INCLUDE_PYVER} installed. Are you sure you don't want Panda to install a compatible copy of Python?$\r$\n$\r$\nIf you choose Yes, you will not be able to do Python development with Panda3D until you install a ${REGVIEW}-bit version of Python and install the bindings for this version." \
  479. IDYES SkipCheck
  480. ; User clicked no, so re-enable the select box and abort.
  481. IntOp $R0 $R0 | ${SF_SELECTED}
  482. SectionSetFlags ${SecPython} $R0
  483. Abort
  484. SkipCheck:
  485. FunctionEnd
  486. !endif
  487. Section "C++ support" SecHeadersLibs
  488. SectionIn 1 2
  489. SetDetailsPrint both
  490. DetailPrint "Installing header files..."
  491. SetDetailsPrint listonly
  492. SetOutPath $INSTDIR\include
  493. File /r /x *.exp "${BUILT}\include\*"
  494. SetDetailsPrint both
  495. DetailPrint "Installing library archives..."
  496. SetDetailsPrint listonly
  497. SetOutPath $INSTDIR\lib
  498. File /r /x *.exp "${BUILT}\lib\*"
  499. SectionEnd
  500. !ifdef HAVE_SAMPLES
  501. Section "Sample programs" SecSamples
  502. SectionIn 1 2
  503. ; Necessary for proper start menu shortcut installation
  504. SetShellVarContext current
  505. SetDetailsPrint both
  506. DetailPrint "Installing sample programs..."
  507. SetDetailsPrint listonly
  508. SetOutPath $INSTDIR\samples
  509. File /nonfatal /r /x CVS "${SOURCE}\samples\*"
  510. SetDetailsPrint both
  511. DetailPrint "Creating shortcuts..."
  512. SetDetailsPrint listonly
  513. SetOutPath $INSTDIR
  514. WriteINIStr $INSTDIR\Website.url "InternetShortcut" "URL" "https://www.panda3d.org/"
  515. WriteINIStr $INSTDIR\Manual.url "InternetShortcut" "URL" "https://www.panda3d.org/manual/index.php"
  516. WriteINIStr $INSTDIR\Samples.url "InternetShortcut" "URL" "https://www.panda3d.org/manual/index.php/Sample_Programs_in_the_Distribution"
  517. SetOutPath $INSTDIR
  518. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Manual.lnk" "$INSTDIR\Manual.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Manual"
  519. CreateShortCut "$SMPROGRAMS\${TITLE}\Panda3D Website.lnk" "$INSTDIR\Website.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Panda3D Website"
  520. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Program Manual.lnk" "$INSTDIR\Samples.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Sample Program Manual"
  521. FindFirst $0 $1 $INSTDIR\samples\*
  522. loop:
  523. StrCmp $1 "" done
  524. StrCmp $1 "." next
  525. StrCmp $1 ".." next
  526. FindFirst $2 $3 $INSTDIR\samples\$1\*.py
  527. StrCmp $3 "" next
  528. Push $1
  529. Push "-"
  530. Push " "
  531. Call StrRep
  532. Call Capitalize
  533. Pop $R0
  534. StrCpy $READABLE $R0
  535. Push $1
  536. Push "-"
  537. Push "_"
  538. Call StrRep
  539. Pop $R0
  540. StrCpy $MANPAGE $R0
  541. DetailPrint "Creating shortcuts for sample program $READABLE"
  542. CreateDirectory "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE"
  543. SetOutPath $INSTDIR\samples\$1
  544. WriteINIStr $INSTDIR\samples\$1\ManualPage.url "InternetShortcut" "URL" "https://www.panda3d.org/wiki/index.php/Sample_Programs:_$MANPAGE"
  545. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Manual Page.lnk" "$INSTDIR\samples\$1\ManualPage.url" "" "$INSTDIR\pandaIcon.ico" 0 "" "" "Manual Entry on this Sample Program"
  546. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\View Source Code.lnk" "$INSTDIR\samples\$1"
  547. iloop:
  548. StrCmp $3 "" idone
  549. CreateShortCut "$SMPROGRAMS\${TITLE}\Sample Programs\$READABLE\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  550. CreateShortCut "$INSTDIR\samples\$1\Run $3.lnk" "$INSTDIR\python\python.exe" "-E $3" "$INSTDIR\pandaIcon.ico" 0 SW_SHOWMINIMIZED "" "Run $3"
  551. FindNext $2 $3
  552. goto iloop
  553. idone:
  554. next:
  555. FindNext $0 $1
  556. Goto loop
  557. done:
  558. SectionEnd
  559. !endif
  560. !ifdef HAVE_MAX_PLUGINS
  561. Section "3ds Max plug-ins" SecMaxPlugins
  562. SectionIn 1 2
  563. SetDetailsPrint both
  564. DetailPrint "Installing Autodesk 3ds Max plug-ins..."
  565. SetDetailsPrint listonly
  566. SetOutPath $INSTDIR\plugins
  567. File /nonfatal /r "${BUILT}\plugins\*.dle"
  568. File /nonfatal /r "${BUILT}\plugins\*.dlo"
  569. File /nonfatal /r "${BUILT}\plugins\*.ms"
  570. SectionEnd
  571. !endif
  572. !ifdef HAVE_MAYA_PLUGINS
  573. Section "Maya plug-ins" SecMayaPlugins
  574. SectionIn 1 2
  575. SetDetailsPrint both
  576. DetailPrint "Installing Autodesk Maya plug-ins..."
  577. SetDetailsPrint listonly
  578. SetOutPath $INSTDIR\plugins
  579. File /nonfatal /r "${BUILT}\plugins\*.mll"
  580. File /nonfatal /r "${BUILT}\plugins\*.mel"
  581. SectionEnd
  582. !endif
  583. Section -post
  584. !ifdef REGVIEW
  585. SetRegView ${REGVIEW}
  586. !endif
  587. ; Run eggcacher. We can't do this in SecCore because we haven't
  588. ; installed eggcacher at that point yet.
  589. SetDetailsPrint both
  590. DetailPrint "Preloading .egg files into the model cache..."
  591. SetDetailsPrint listonly
  592. SetOutPath $INSTDIR
  593. nsExec::ExecToLog '"$INSTDIR\python\python.exe" -m direct.directscripts.eggcacher --concise models samples'
  594. Pop $0
  595. DetailPrint "Command returned exit status $0"
  596. SetDetailsPrint both
  597. DetailPrint "Writing the uninstaller ..."
  598. SetDetailsPrint listonly
  599. Delete "$INSTDIR\uninst.exe"
  600. WriteUninstaller "$INSTDIR\uninst.exe"
  601. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "DisplayName" "${TITLE}"
  602. WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}" "UninstallString" '"$INSTDIR\uninst.exe"'
  603. SetOutPath $INSTDIR
  604. CreateShortcut "$SMPROGRAMS\${TITLE}\Uninstall ${TITLE}.lnk" "$INSTDIR\uninst.exe" ""
  605. SetDetailsPrint both
  606. DetailPrint "Registering file type associations..."
  607. SetDetailsPrint listonly
  608. ; Even though we need the runtime to run these, we might as well tell
  609. ; Windows what this kind of file is.
  610. WriteRegStr HKCU "Software\Classes\.p3d" "" "Panda3D applet"
  611. WriteRegStr HKCU "Software\Classes\.p3d" "Content Type" "application/x-panda3d"
  612. WriteRegStr HKCU "Software\Classes\.p3d" "PerceivedType" "application"
  613. ; Register various model files
  614. WriteRegStr HKCU "Software\Classes\.egg" "" "Panda3D.Model"
  615. WriteRegStr HKCU "Software\Classes\.egg" "Content Type" "application/x-egg"
  616. WriteRegStr HKCU "Software\Classes\.egg" "PerceivedType" "gamemedia"
  617. WriteRegStr HKCU "Software\Classes\.bam" "" "Panda3D.Model"
  618. WriteRegStr HKCU "Software\Classes\.bam" "Content Type" "application/x-bam"
  619. WriteRegStr HKCU "Software\Classes\.bam" "PerceivedType" "gamemedia"
  620. WriteRegStr HKCU "Software\Classes\.pz" "" "Panda3D.Compressed"
  621. WriteRegStr HKCU "Software\Classes\.pz" "PerceivedType" "compressed"
  622. WriteRegStr HKCU "Software\Classes\.mf" "" "Panda3D.Multifile"
  623. WriteRegStr HKCU "Software\Classes\.mf" "PerceivedType" "compressed"
  624. WriteRegStr HKCU "Software\Classes\.prc" "" "inifile"
  625. WriteRegStr HKCU "Software\Classes\.prc" "Content Type" "text/plain"
  626. WriteRegStr HKCU "Software\Classes\.prc" "PerceivedType" "text"
  627. ; For convenience, if nobody registered .pyd, we will.
  628. ReadRegStr $0 HKCR "Software\Classes\.pyd" ""
  629. StrCmp $0 "" 0 +2
  630. WriteRegStr HKCU "Software\Classes\.pyd" "" "dllfile"
  631. SetDetailsPrint both
  632. DetailPrint "Adding directories to system PATH..."
  633. SetDetailsPrint listonly
  634. # Add the "bin" directory to the PATH.
  635. Push "$INSTDIR\python"
  636. Call RemoveFromPath
  637. Push "$INSTDIR\python\Scripts"
  638. Call RemoveFromPath
  639. Push "$INSTDIR\bin"
  640. Call RemoveFromPath
  641. Push "$INSTDIR\python;$INSTDIR\python\Scripts;$INSTDIR\bin"
  642. Call AddToPath
  643. # This is needed for the environment variable changes to take effect.
  644. DetailPrint "Broadcasting WM_WININICHANGE message..."
  645. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  646. # Now dump the log to disk.
  647. StrCpy $0 "$INSTDIR\install.log"
  648. Push $0
  649. Call DumpLog
  650. SectionEnd
  651. Section Uninstall
  652. SetDetailsPrint listonly
  653. SetShellVarContext current
  654. !ifdef REGVIEW
  655. SetRegView ${REGVIEW}
  656. !endif
  657. SetDetailsPrint both
  658. DetailPrint "Removing registry entries..."
  659. SetDetailsPrint listonly
  660. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  661. DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${TITLE}"
  662. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Model\DefaultIcon" ""
  663. StrCmp $0 "$INSTDIR\bin\pview.exe" 0 +3
  664. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\DefaultIcon"
  665. DeleteRegKey HKCU "Software\Classes\Panda3D.Model\shell"
  666. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon" ""
  667. StrCmp $0 "$INSTDIR\bin\pzip.exe" 0 +3
  668. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\DefaultIcon"
  669. DeleteRegKey HKCU "Software\Classes\Panda3D.Compressed\shell"
  670. ReadRegStr $0 HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon" ""
  671. StrCmp $0 "$INSTDIR\bin\multify.exe" 0 +3
  672. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\DefaultIcon"
  673. DeleteRegKey HKCU "Software\Classes\Panda3D.Multifile\shell"
  674. !ifdef INCLUDE_PYVER
  675. ReadRegStr $0 HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  676. StrCmp $0 "$INSTDIR\python" 0 +2
  677. DeleteRegKey HKLM "Software\Python\PythonCore\${INCLUDE_PYVER}"
  678. ReadRegStr $0 HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}\InstallPath" ""
  679. StrCmp $0 "$INSTDIR\python" 0 +2
  680. DeleteRegKey HKCU "Software\Python\PythonCore\${INCLUDE_PYVER}"
  681. !endif
  682. !insertmacro RemovePythonPath 2.7
  683. !if "${REGVIEW}" == "32"
  684. !insertmacro RemovePythonPath 3.5-32
  685. !insertmacro RemovePythonPath 3.6-32
  686. !insertmacro RemovePythonPath 3.7-32
  687. !insertmacro RemovePythonPath 3.8-32
  688. !insertmacro RemovePythonPath 3.9-32
  689. !else
  690. !insertmacro RemovePythonPath 3.5
  691. !insertmacro RemovePythonPath 3.6
  692. !insertmacro RemovePythonPath 3.7
  693. !insertmacro RemovePythonPath 3.8
  694. !insertmacro RemovePythonPath 3.9
  695. !endif
  696. SetDetailsPrint both
  697. DetailPrint "Deleting files..."
  698. SetDetailsPrint listonly
  699. Delete "$INSTDIR\uninst.exe"
  700. RMDir /r "$INSTDIR"
  701. SetDetailsPrint both
  702. DetailPrint "Removing Start Menu entries..."
  703. SetDetailsPrint listonly
  704. SetShellVarContext current
  705. RMDir /r "$SMPROGRAMS\${TITLE}"
  706. SetShellVarContext all
  707. RMDir /r "$SMPROGRAMS\${TITLE}"
  708. SetDetailsPrint both
  709. DetailPrint "Removing entries from PATH..."
  710. SetDetailsPrint listonly
  711. Push "$INSTDIR\python"
  712. Call un.RemoveFromPath
  713. Push "$INSTDIR\python\Scripts"
  714. Call un.RemoveFromPath
  715. Push "$INSTDIR\bin"
  716. Call un.RemoveFromPath
  717. # This is needed for the environment variable changes to take effect.
  718. DetailPrint "Broadcasting WM_WININICHANGE message..."
  719. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
  720. SectionEnd
  721. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  722. !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(DESC_SecCore)
  723. !ifdef HAVE_GL
  724. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenGL} $(DESC_SecOpenGL)
  725. !endif
  726. !ifdef HAVE_DX9
  727. !insertmacro MUI_DESCRIPTION_TEXT ${SecDirect3D9} $(DESC_SecDirect3D9)
  728. !endif
  729. !ifdef HAVE_OPENAL
  730. !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenAL} $(DESC_SecOpenAL)
  731. !endif
  732. !ifdef HAVE_FMOD
  733. !insertmacro MUI_DESCRIPTION_TEXT ${SecFMOD} $(DESC_SecFMOD)
  734. !endif
  735. !ifdef HAVE_FFMPEG
  736. !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMpeg} $(DESC_SecFFMpeg)
  737. !endif
  738. !ifdef HAVE_BULLET
  739. !insertmacro MUI_DESCRIPTION_TEXT ${SecBullet} $(DESC_SecBullet)
  740. !endif
  741. !ifdef HAVE_ODE
  742. !insertmacro MUI_DESCRIPTION_TEXT ${SecODE} $(DESC_SecODE)
  743. !endif
  744. !ifdef HAVE_PHYSX
  745. !insertmacro MUI_DESCRIPTION_TEXT ${SecPhysX} $(DESC_SecPhysX)
  746. !endif
  747. !ifdef HAVE_ROCKET
  748. !insertmacro MUI_DESCRIPTION_TEXT ${SecRocket} $(DESC_SecRocket)
  749. !endif
  750. !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools)
  751. !insertmacro MUI_DESCRIPTION_TEXT ${SecGroupPython} $(DESC_SecGroupPython)
  752. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyShared} $(DESC_SecPyShared)
  753. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings2.7} $(DESC_SecPyBindings2.7)
  754. !if "${REGVIEW}" == "32"
  755. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5-32} $(DESC_SecPyBindings3.5-32)
  756. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6-32} $(DESC_SecPyBindings3.6-32)
  757. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7-32} $(DESC_SecPyBindings3.7-32)
  758. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8-32} $(DESC_SecPyBindings3.8-32)
  759. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9-32} $(DESC_SecPyBindings3.9-32)
  760. !else
  761. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.5} $(DESC_SecPyBindings3.5)
  762. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.6} $(DESC_SecPyBindings3.6)
  763. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.7} $(DESC_SecPyBindings3.7)
  764. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.8} $(DESC_SecPyBindings3.8)
  765. !insertmacro MUI_DESCRIPTION_TEXT ${SecPyBindings3.9} $(DESC_SecPyBindings3.9)
  766. !endif
  767. !ifdef INCLUDE_PYVER
  768. !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} $(DESC_SecPython)
  769. !endif
  770. !insertmacro MUI_DESCRIPTION_TEXT ${SecHeadersLibs} $(DESC_SecHeadersLibs)
  771. !ifdef HAVE_SAMPLES
  772. !insertmacro MUI_DESCRIPTION_TEXT ${SecSamples} $(DESC_SecSamples)
  773. !endif
  774. !ifdef HAVE_MAX_PLUGINS
  775. !insertmacro MUI_DESCRIPTION_TEXT ${SecMaxPlugins} $(DESC_SecMaxPlugins)
  776. !endif
  777. !ifdef HAVE_MAYA_PLUGINS
  778. !insertmacro MUI_DESCRIPTION_TEXT ${SecMayaPlugins} $(DESC_SecMayaPlugins)
  779. !endif
  780. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  781. # --[ Utility Functions ]------------------------------------------------------
  782. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  783. Function IsNT
  784. Push $0
  785. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  786. StrCmp $0 "" 0 IsNT_yes
  787. ; we are not NT.
  788. Pop $0
  789. Push 0
  790. Return
  791. IsNT_yes:
  792. ; NT!!!
  793. Pop $0
  794. Push 1
  795. FunctionEnd
  796. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  797. Function un.IsNT
  798. Push $0
  799. ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
  800. StrCmp $0 "" 0 unIsNT_yes
  801. ; we are not NT.
  802. Pop $0
  803. Push 0
  804. Return
  805. unIsNT_yes:
  806. ; NT!!!
  807. Pop $0
  808. Push 1
  809. FunctionEnd
  810. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  811. Function StrStr
  812. Push $0
  813. Exch
  814. Pop $0 ; $0 now have the string to find
  815. Push $1
  816. Exch 2
  817. Pop $1 ; $1 now have the string to find in
  818. Exch
  819. Push $2
  820. Push $3
  821. Push $4
  822. Push $5
  823. StrCpy $2 -1
  824. StrLen $3 $0
  825. StrLen $4 $1
  826. IntOp $4 $4 - $3
  827. unStrStr_loop:
  828. IntOp $2 $2 + 1
  829. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  830. StrCpy $5 $1 $3 $2
  831. StrCmp $5 $0 unStrStr_done unStrStr_loop
  832. unStrStrReturn_notFound:
  833. StrCpy $2 -1
  834. unStrStr_done:
  835. Pop $5
  836. Pop $4
  837. Pop $3
  838. Exch $2
  839. Exch 2
  840. Pop $0
  841. Pop $1
  842. FunctionEnd
  843. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  844. Function un.StrStr
  845. Push $0
  846. Exch
  847. Pop $0 ; $0 now have the string to find
  848. Push $1
  849. Exch 2
  850. Pop $1 ; $1 now have the string to find in
  851. Exch
  852. Push $2
  853. Push $3
  854. Push $4
  855. Push $5
  856. StrCpy $2 -1
  857. StrLen $3 $0
  858. StrLen $4 $1
  859. IntOp $4 $4 - $3
  860. unStrStr_loop:
  861. IntOp $2 $2 + 1
  862. IntCmp $2 $4 0 0 unStrStrReturn_notFound
  863. StrCpy $5 $1 $3 $2
  864. StrCmp $5 $0 unStrStr_done unStrStr_loop
  865. unStrStrReturn_notFound:
  866. StrCpy $2 -1
  867. unStrStr_done:
  868. Pop $5
  869. Pop $4
  870. Pop $3
  871. Exch $2
  872. Exch 2
  873. Pop $0
  874. Pop $1
  875. FunctionEnd
  876. ; Capitalizes the first letter of every word.
  877. Function Capitalize
  878. Exch $R0
  879. Push $0
  880. Push $1
  881. Push $2
  882. StrCpy $0 0
  883. capNext:
  884. ; Grab the next character.
  885. StrCpy $1 $R0 1 $0
  886. StrCmp $1 '' end
  887. ; Capitalize it.
  888. ${StrFilter} '$1' '+eng' '' '' $1
  889. ${StrFilter} '$1' '+rus' '' '' $1
  890. ; Splice it into the string.
  891. StrCpy $2 $R0 $0
  892. IntOp $0 $0 + 1
  893. StrCpy $R0 $R0 '' $0
  894. StrCpy $R0 '$2$1$R0'
  895. ; Keep looping through the characters until we find a
  896. ; delimiter or reach the end of the string.
  897. loop:
  898. StrCpy $1 $R0 1 $0
  899. IntOp $0 $0 + 1
  900. StrCmp $1 '' end
  901. StrCmp $1 ' ' capNext
  902. StrCmp $1 '_' capNext
  903. StrCmp $1 '-' capNext
  904. StrCmp $1 '(' capNext
  905. StrCmp $1 '[' capNext
  906. Goto loop
  907. end:
  908. Pop $2
  909. Pop $1
  910. Pop $0
  911. Exch $R0
  912. FunctionEnd
  913. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  914. ; Commentary and smarter ';' checking by Jon Parise <[email protected]>
  915. Function AddToPath
  916. Exch $0
  917. Push $1
  918. Push $2
  919. Push $3
  920. Call IsNT
  921. Pop $1
  922. DetailPrint "Adding to PATH: $0"
  923. StrCmp $1 1 AddToPath_NT
  924. ; We're not on NT, so modify the AUTOEXEC.BAT file.
  925. StrCpy $1 $WINDIR 2
  926. FileOpen $1 "$1\autoexec.bat" a
  927. FileSeek $1 0 END
  928. GetFullPathName /SHORT $0 $0
  929. FileWrite $1 "$\r$\nSET PATH=%PATH%;$0$\r$\n"
  930. FileClose $1
  931. Goto AddToPath_done
  932. AddToPath_NT:
  933. ClearErrors
  934. ReadRegStr $1 HKCU "Environment" "PATH"
  935. ; If we reached an error, WATCH OUT. Either this means that
  936. ; the registry key did not exist, or that it didn't fit in
  937. ; NSIS' string limit. If the latter, we have to be very
  938. ; careful not to overwrite the user's PATH.
  939. IfErrors AddToPath_Error
  940. DetailPrint "Current PATH value is set to $1"
  941. StrCmp $1 "" AddToPath_NTAddPath
  942. ; Pull off the last character of the PATH string. If it's a semicolon,
  943. ; we don't need to add another one, so jump to the section where we
  944. ; append the new PATH component(s).
  945. StrCpy $2 $1 1 -1
  946. StrCmp $2 ";" AddToPath_NTAddPath AddToPath_NTAddSemi
  947. AddToPath_Error:
  948. DetailPrint "Encountered error reading PATH variable."
  949. ; Does the variable exist? If it doesn't, then the
  950. ; error happened because we need to create the
  951. ; variable. If it does, then we failed to read it
  952. ; because we reached NSIS' string limit.
  953. StrCpy $3 0
  954. AddToPath_loop:
  955. EnumRegValue $4 HKCU "Environment" $3
  956. StrCmp $4 "PATH" AddToPath_ExceedLimit
  957. StrCmp $4 "" AddToPath_NTAddPath
  958. IntOp $3 $3 + 1
  959. Goto AddToPath_loop
  960. AddToPath_ExceedLimit:
  961. MessageBox MB_ABORTRETRYIGNORE|MB_ICONEXCLAMATION "Your PATH environment variable is too long! Please remove extraneous entries before proceeding. Panda3D needs to add the following the PATH so that the Panda3D utilities and libraries can be located correctly.$\n$\n$0$\n$\nIf you wish to add Panda3D to the path yourself, choose Ignore." IDIGNORE AddToPath_done IDRETRY AddToPath_NT
  962. SetDetailsPrint both
  963. DetailPrint "Cannot append to PATH - variable is likely too long."
  964. SetDetailsPrint listonly
  965. Abort
  966. AddToPath_NTAddSemi:
  967. StrCpy $1 "$1;"
  968. Goto AddToPath_NTAddPath
  969. AddToPath_NTAddPath:
  970. StrCpy $0 "$1$0"
  971. WriteRegExpandStr HKCU "Environment" "PATH" $0
  972. AddToPath_done:
  973. Pop $3
  974. Pop $2
  975. Pop $1
  976. Pop $0
  977. FunctionEnd
  978. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  979. Function RemoveFromPath
  980. Exch $0
  981. Push $1
  982. Push $2
  983. Push $3
  984. Push $4
  985. Push $5
  986. Call IsNT
  987. Pop $1
  988. DetailPrint "Removing from PATH: $0"
  989. StrCmp $1 1 unRemoveFromPath_NT
  990. ; Not on NT
  991. StrCpy $1 $WINDIR 2
  992. FileOpen $1 "$1\autoexec.bat" r
  993. GetTempFileName $4
  994. FileOpen $2 $4 w
  995. GetFullPathName /SHORT $0 $0
  996. StrCpy $0 "SET PATH=%PATH%;$0"
  997. SetRebootFlag true
  998. Goto unRemoveFromPath_dosLoop
  999. unRemoveFromPath_dosLoop:
  1000. FileRead $1 $3
  1001. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1002. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1003. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1004. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1005. FileWrite $2 $3
  1006. Goto unRemoveFromPath_dosLoop
  1007. unRemoveFromPath_dosLoopEnd:
  1008. FileClose $2
  1009. FileClose $1
  1010. StrCpy $1 $WINDIR 2
  1011. Delete "$1\autoexec.bat"
  1012. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1013. Delete $4
  1014. Goto unRemoveFromPath_done
  1015. unRemoveFromPath_NT:
  1016. Push $0
  1017. StrLen $2 $0
  1018. ReadRegStr $1 HKCU "Environment" "PATH"
  1019. Push $1
  1020. Push $0
  1021. Call StrStr ; Find $0 in $1
  1022. Pop $0 ; pos of our dir
  1023. IntCmp $0 -1 unRemoveFromPath_NT_System
  1024. ; else, it is in path
  1025. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1026. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1027. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1028. StrLen $0 $1
  1029. StrCpy $1 $1 $0 $2
  1030. StrCpy $3 "$3$1"
  1031. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1032. unRemoveFromPath_NT_System:
  1033. Pop $0
  1034. StrLen $2 $0
  1035. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1036. Push $1
  1037. Push $0
  1038. Call StrStr ; Find $0 in $1
  1039. Pop $0 ; pos of our dir
  1040. IntCmp $0 -1 unRemoveFromPath_done
  1041. ; else, it is in path
  1042. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1043. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1044. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1045. StrLen $0 $1
  1046. StrCpy $1 $1 $0 $2
  1047. StrCpy $3 "$3$1"
  1048. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1049. unRemoveFromPath_done:
  1050. Pop $5
  1051. Pop $4
  1052. Pop $3
  1053. Pop $2
  1054. Pop $1
  1055. Pop $0
  1056. FunctionEnd
  1057. ; From: http://nsis.sourceforge.net/archive/viewpage.php?pageid=91
  1058. Function un.RemoveFromPath
  1059. Exch $0
  1060. Push $1
  1061. Push $2
  1062. Push $3
  1063. Push $4
  1064. Push $5
  1065. Call un.IsNT
  1066. Pop $1
  1067. StrCmp $1 1 unRemoveFromPath_NT
  1068. ; Not on NT
  1069. StrCpy $1 $WINDIR 2
  1070. FileOpen $1 "$1\autoexec.bat" r
  1071. GetTempFileName $4
  1072. FileOpen $2 $4 w
  1073. GetFullPathName /SHORT $0 $0
  1074. StrCpy $0 "SET PATH=%PATH%;$0"
  1075. SetRebootFlag true
  1076. Goto unRemoveFromPath_dosLoop
  1077. unRemoveFromPath_dosLoop:
  1078. FileRead $1 $3
  1079. StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoop
  1080. StrCmp $3 "$0$\n" unRemoveFromPath_dosLoop
  1081. StrCmp $3 "$0" unRemoveFromPath_dosLoop
  1082. StrCmp $3 "" unRemoveFromPath_dosLoopEnd
  1083. FileWrite $2 $3
  1084. Goto unRemoveFromPath_dosLoop
  1085. unRemoveFromPath_dosLoopEnd:
  1086. FileClose $2
  1087. FileClose $1
  1088. StrCpy $1 $WINDIR 2
  1089. Delete "$1\autoexec.bat"
  1090. CopyFiles /SILENT $4 "$1\autoexec.bat"
  1091. Delete $4
  1092. Goto unRemoveFromPath_done
  1093. unRemoveFromPath_NT:
  1094. Push $0
  1095. StrLen $2 $0
  1096. ReadRegStr $1 HKCU "Environment" "PATH"
  1097. Push $1
  1098. Push $0
  1099. Call un.StrStr ; Find $0 in $1
  1100. Pop $0 ; pos of our dir
  1101. IntCmp $0 -1 unRemoveFromPath_NT_System
  1102. ; else, it is in path
  1103. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1104. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1105. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1106. StrLen $0 $1
  1107. StrCpy $1 $1 $0 $2
  1108. StrCpy $3 "$3$1"
  1109. WriteRegExpandStr HKCU "Environment" "PATH" $3
  1110. unRemoveFromPath_NT_System:
  1111. Pop $0
  1112. StrLen $2 $0
  1113. ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
  1114. Push $1
  1115. Push $0
  1116. Call un.StrStr ; Find $0 in $1
  1117. Pop $0 ; pos of our dir
  1118. IntCmp $0 -1 unRemoveFromPath_done
  1119. ; else, it is in path
  1120. StrCpy $3 $1 $0 ; $3 now has the part of the path before our dir
  1121. IntOp $2 $2 + $0 ; $2 now contains the pos after our dir in the path (';')
  1122. IntOp $2 $2 + 1 ; $2 now containts the pos after our dir and the semicolon.
  1123. StrLen $0 $1
  1124. StrCpy $1 $1 $0 $2
  1125. StrCpy $3 "$3$1"
  1126. WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
  1127. unRemoveFromPath_done:
  1128. Pop $5
  1129. Pop $4
  1130. Pop $3
  1131. Pop $2
  1132. Pop $1
  1133. Pop $0
  1134. FunctionEnd
  1135. Function StrRep
  1136. ;Written by dirtydingus 2003-02-20 04:30:09
  1137. ; USAGE
  1138. ;Push String to do replacement in (haystack)
  1139. ;Push String to replace (needle)
  1140. ;Push Replacement
  1141. ;Call StrRep
  1142. ;Pop $R0 result
  1143. ;StrCpy $Result STR $R0
  1144. Exch $R4 ; $R4 = Replacement String
  1145. Exch
  1146. Exch $R3 ; $R3 = String to replace (needle)
  1147. Exch 2
  1148. Exch $R1 ; $R1 = String to do replacement in (haystack)
  1149. Push $R2 ; Replaced haystack
  1150. Push $R5 ; Len (needle)
  1151. Push $R6 ; len (haystack)
  1152. Push $R7 ; Scratch reg
  1153. StrCpy $R2 ""
  1154. StrLen $R5 $R3
  1155. StrLen $R6 $R1
  1156. loop:
  1157. StrCpy $R7 $R1 $R5
  1158. StrCmp $R7 $R3 found
  1159. StrCpy $R7 $R1 1 ; - optimization can be removed if U know len needle=1
  1160. StrCpy $R2 "$R2$R7"
  1161. StrCpy $R1 $R1 $R6 1
  1162. StrCmp $R1 "" done loop
  1163. found:
  1164. StrCpy $R2 "$R2$R4"
  1165. StrCpy $R1 $R1 $R6 $R5
  1166. StrCmp $R1 "" done loop
  1167. done:
  1168. StrCpy $R3 $R2
  1169. Pop $R7
  1170. Pop $R6
  1171. Pop $R5
  1172. Pop $R2
  1173. Pop $R1
  1174. Pop $R4
  1175. Exch $R3
  1176. FunctionEnd
  1177. !ifndef LVM_GETITEMCOUNT
  1178. !define LVM_GETITEMCOUNT 0x1004
  1179. !endif
  1180. !ifndef LVM_GETITEMTEXT
  1181. !define LVM_GETITEMTEXT 0x102D
  1182. !endif
  1183. Function DumpLog
  1184. Exch $5
  1185. Push $0
  1186. Push $1
  1187. Push $2
  1188. Push $3
  1189. Push $4
  1190. Push $6
  1191. FindWindow $0 "#32770" "" $HWNDPARENT
  1192. GetDlgItem $0 $0 1016
  1193. StrCmp $0 0 exit
  1194. FileOpen $5 $5 "w"
  1195. StrCmp $5 "" exit
  1196. SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
  1197. System::Alloc ${NSIS_MAX_STRLEN}
  1198. Pop $3
  1199. StrCpy $2 0
  1200. System::Call "*(i, i, i, i, i, i, i, i, i) i \
  1201. (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
  1202. loop: StrCmp $2 $6 done
  1203. System::Call "User32::SendMessageA(i, i, i, i) i \
  1204. ($0, ${LVM_GETITEMTEXT}, $2, r1)"
  1205. System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
  1206. FileWrite $5 "$4$\r$\n"
  1207. IntOp $2 $2 + 1
  1208. Goto loop
  1209. done:
  1210. FileClose $5
  1211. System::Free $1
  1212. System::Free $3
  1213. exit:
  1214. Pop $6
  1215. Pop $4
  1216. Pop $3
  1217. Pop $2
  1218. Pop $1
  1219. Pop $0
  1220. Exch $5
  1221. FunctionEnd