build.sh 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. #!/bin/bash
  2. WD=`pwd`/Builds
  3. DIR="src"
  4. LIBS="libs"
  5. COP="license"
  6. GAME="Photon-Project"
  7. TEMP=`mktemp -d`
  8. mkdir -p Builds
  9. if [ "$1" == "nix" ]; then {
  10. cp -Rv "$DIR" $TEMP
  11. cp -Rv "$LIBS".zip $TEMP
  12. cp -Rv "$COP" $TEMP
  13. cd $TEMP
  14. unzip "$LIBS".zip
  15. cd "$DIR"
  16. zip -9 -r "$GAME".love .
  17. cd ..
  18. mkdir -p Linux_Output
  19. cd Linux_Output
  20. cp -r ../"$COP" .
  21. cat ../"$LIBS"/linux/bin/love ../"$DIR"/"$GAME".love > ../"$LIBS"/linux/bin/"$GAME"
  22. chmod +x ../"$LIBS"/linux/bin/"$GAME"
  23. cat << 'EOF' > ../"$LIBS"/linux/love.desktop
  24. [Desktop Entry]
  25. Name=The Photon Project
  26. Comment=When the light denied the past
  27. MimeType=application/x-love-game;
  28. Exec=Photon-Project %f
  29. Type=Application
  30. Categories=Game;
  31. Terminal=false
  32. Icon=love
  33. EOF
  34. ./../"$LIBS"/appimagetool.AppImage ../"$LIBS"/linux "$GAME".AppImage
  35. cd ..
  36. cp -r Linux_Output "$WD"
  37. rm -rf $TEMP
  38. }
  39. elif [ "$1" == "win" ]; then {
  40. if [ "$2" == "32" ]; then {
  41. cp -Rv "$DIR" $TEMP
  42. cp -Rv "$LIBS".zip $TEMP
  43. cp -Rv "$COP" $TEMP
  44. cd $TEMP
  45. unzip "$LIBS".zip
  46. cd "$DIR"
  47. zip -9 -r "$GAME".love .
  48. cd ..
  49. mkdir -p Win32_Output
  50. cd Win32_Output
  51. cp -r ../"$LIBS"/win32/*dll .
  52. cp -r ../"$COP" .
  53. cat ../"$LIBS"/win32/love.exe ../"$DIR"/"$GAME".love > "$GAME".exe
  54. cd ..
  55. cp -r Win32_Output "$WD"
  56. rm -rf $TEMP
  57. }
  58. elif [ "$2" == "64" ]; then {
  59. cp -Rv "$DIR" $TEMP
  60. cp -Rv "$LIBS".zip $TEMP
  61. cp -Rv "$COP" $TEMP
  62. cd $TEMP
  63. unzip "$LIBS".zip
  64. cd "$DIR"
  65. zip -9 -r "$GAME".love .
  66. cd ..
  67. mkdir -p Win64_Output
  68. cd Win64_Output
  69. cp -r ../"$LIBS"/win64/*dll .
  70. cp -r ../"$COP" .
  71. cat ../"$LIBS"/win64/love.exe ../"$DIR"/"$GAME".love > "$GAME".exe
  72. cd ..
  73. cp -r Win64_Output "$WD"
  74. rm -rf $TEMP
  75. }
  76. else {
  77. echo "Wrong architecture / Specify one"
  78. } fi
  79. }
  80. elif [ "$1" == "mac" ]; then {
  81. cp -Rv "$DIR" $TEMP
  82. cp -Rv "$LIBS".zip $TEMP
  83. cp -Rv "$COP" $TEMP
  84. cd $TEMP
  85. unzip "$LIBS".zip
  86. cd "$DIR"
  87. zip -9 -r "$GAME".love .
  88. cd ..
  89. mkdir -p Mac_Output
  90. cd Mac_Output
  91. cp -r ../"$COP" .
  92. mv ../"$LIBS"/macos/love.app ../"$LIBS"/macos/"$GAME".app
  93. cp -r ../"$DIR"/"$GAME".love ../"$LIBS"/macos/"$GAME".app/Contents/Resources/
  94. cat << EOF > ../"$LIBS"/macos/"$GAME".app/Contents/Info.plist
  95. <?xml version="1.0" encoding="UTF-8"?>
  96. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  97. <plist version="1.0">
  98. <dict>
  99. <key>BuildMachineOSBuild</key>
  100. <string>21D49</string>
  101. <key>CFBundleDevelopmentRegion</key>
  102. <string>English</string>
  103. <key>CFBundleDocumentTypes</key>
  104. <array>
  105. <dict>
  106. <key>CFBundleTypeExtensions</key>
  107. <array>
  108. <string>love</string>
  109. </array>
  110. <key>CFBundleTypeIconFile</key>
  111. <string>GameIcon</string>
  112. <key>CFBundleTypeName</key>
  113. <string>LÖVE Project</string>
  114. <key>CFBundleTypeRole</key>
  115. <string>Viewer</string>
  116. <key>LSHandlerRank</key>
  117. <string>Owner</string>
  118. <key>LSItemContentTypes</key>
  119. <array>
  120. <string>org.love2d.love-game</string>
  121. </array>
  122. <key>LSTypeIsPackage</key>
  123. <integer>1</integer>
  124. </dict>
  125. <dict>
  126. <key>CFBundleTypeName</key>
  127. <string>Folder</string>
  128. <key>CFBundleTypeOSTypes</key>
  129. <array>
  130. <string>fold</string>
  131. </array>
  132. <key>CFBundleTypeRole</key>
  133. <string>Viewer</string>
  134. <key>LSHandlerRank</key>
  135. <string>None</string>
  136. </dict>
  137. <dict>
  138. <key>CFBundleTypeIconFile</key>
  139. <string>Document</string>
  140. <key>CFBundleTypeName</key>
  141. <string>Document</string>
  142. <key>CFBundleTypeOSTypes</key>
  143. <array>
  144. <string>****</string>
  145. </array>
  146. <key>CFBundleTypeRole</key>
  147. <string>Editor</string>
  148. </dict>
  149. </array>
  150. <key>CFBundleExecutable</key>
  151. <string>love</string>
  152. <key>CFBundleIconFile</key>
  153. <string>OS X AppIcon</string>
  154. <key>CFBundleIconName</key>
  155. <string>OS X AppIcon</string>
  156. <key>CFBundleIdentifier</key>
  157. <string>org.PhotonTeam.PhotonProject</string>
  158. <key>CFBundleInfoDictionaryVersion</key>
  159. <string>6.0</string>
  160. <key>CFBundleName</key>
  161. <string>Photon Project</string>
  162. <key>CFBundlePackageType</key>
  163. <string>APPL</string>
  164. <key>CFBundleShortVersionString</key>
  165. <string>11.4a</string>
  166. <key>CFBundleSignature</key>
  167. <string>LoVe</string>
  168. <key>CFBundleSupportedPlatforms</key>
  169. <array>
  170. <string>MacOSX</string>
  171. </array>
  172. <key>DTCompiler</key>
  173. <string>com.apple.compilers.llvm.clang.1_0</string>
  174. <key>DTPlatformBuild</key>
  175. <string>13C100</string>
  176. <key>DTPlatformName</key>
  177. <string>macosx</string>
  178. <key>DTPlatformVersion</key>
  179. <string>12.1</string>
  180. <key>DTSDKBuild</key>
  181. <string>21C46</string>
  182. <key>DTSDKName</key>
  183. <string>macosx12.1</string>
  184. <key>DTXcode</key>
  185. <string>1321</string>
  186. <key>DTXcodeBuild</key>
  187. <string>13C100</string>
  188. <key>LSApplicationCategoryType</key>
  189. <string>public.app-category.games</string>
  190. <key>LSMinimumSystemVersion</key>
  191. <string>10.7</string>
  192. <key>NSHighResolutionCapable</key>
  193. <true/>
  194. <key>NSHumanReadableCopyright</key>
  195. <string>© 2006-2022 LÖVE Development Team</string>
  196. <key>NSPrincipalClass</key>
  197. <string>NSApplication</string>
  198. <key>NSSupportsAutomaticGraphicsSwitching</key>
  199. <false/>
  200. </dict>
  201. </plist>
  202. EOF
  203. cd ../"$LIBS"/macos/
  204. zip -9 -r -y "$GAME".zip .
  205. cd $TEMP
  206. cp -r "$LIBS"/macos/"$GAME".zip Mac_Output
  207. cp -r Mac_Output "$WD"
  208. rm -rf $TEMP
  209. }
  210. elif [ "$1" == "universal" ]; then {
  211. cp -Rv "$DIR" $TEMP
  212. cp -Rv "$COP" $TEMP
  213. cd $TEMP
  214. cd "$DIR"
  215. zip -9 -r "$GAME".love .
  216. cd ..
  217. mkdir -p Universal_Output
  218. cd Universal_Output
  219. cp -r ../"$COP" .
  220. cp -r ../"$DIR"/"$GAME".love .
  221. cd ..
  222. cp -r Universal_Output "$WD"
  223. rm -rf $TEMP
  224. }
  225. else {
  226. echo "OS not found"
  227. } fi