jpm-build.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. # -*- mode: sh; tab-width: 4; coding: utf-8 -*-
  3. # vim: ts=4 noet ai ft=sh
  4. # Build an SDK-based Firefox add-on.
  5. # This file is part of JPM.sh.
  6. # Copyright (C) 2016 the Desktopd developers
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License as
  10. # published by the Free Software Foundation, either version 3 of the
  11. # License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Affero General Public License
  19. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. # Global branding switch
  21. [ "$JPM_SH_BROWSER_NAME" ] && gBrowserName=$JPM_SH_BROWSER_NAME \
  22. || gBrowserName='Firefox'
  23. [ "$JPM_SH_BROWSER_BIN" ] && gBrowserBinName=$JPM_SH_BROWSER_BIN \
  24. || gBrowserBinName=firefox
  25. # Command line arguments
  26. # May be empty
  27. printPackageName=$1
  28. # JPM.sh directories
  29. gBinDir=`dirname "$0"`
  30. gBinDir=`cd "$gBinDir" ; pwd`
  31. gLibDir=${gBinDir}/../lib
  32. gDepsDir=${gBinDir}/../deps
  33. # Add-on files
  34. gManifestPath=./version_info
  35. # Include needed scripts
  36. . "$gLibDir/defaults.sh"
  37. . "$gLibDir/console.sh"
  38. . "$gLibDir/xpi.sh"
  39. # Build a .xpi package
  40. # Load manifest data
  41. jpmConsoleLog "Loading: $gManifestPath"
  42. [ -f "$gManifestPath" ] || {
  43. jpmConsoleError "No such file: $gManifestPath"
  44. exit 1
  45. }
  46. . "$gManifestPath"
  47. # Production build
  48. isProdBuild=1
  49. jpmConsoleLog "Building .xpi ..."
  50. # The package is streamed into STDOUT
  51. # And the package name into fd #3 (if requested)
  52. jpmXpiBuild "$isProdBuild" "$printPackageName"
  53. jpmConsoleNotice "Done: jpm-build.sh"
  54. # name=`{ jpm-build.sh 1 > tmp.zip ; } 3>&1`
  55. # mv tmp.zip "$name.xpi"