PageRenderTime 60ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/third_party/sqlite/publish.sh

https://github.com/rwatson/chromium-capsicum
Shell | 136 lines | 79 code | 17 blank | 40 comment | 0 complexity | 137680d5ec0149f76c3ccce57422ae9f MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, BSD-3-Clause, Apache-2.0, AGPL-1.0
  1. #!/bin/sh
  2. #
  3. # This script is used to compile SQLite and package everything up
  4. # so that it is ready to move to the SQLite website.
  5. #
  6. # Set srcdir to the name of the directory that contains the publish.sh
  7. # script.
  8. #
  9. srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
  10. # Get the makefile.
  11. #
  12. cp $srcdir/Makefile.linux-gcc ./Makefile
  13. chmod +x $srcdir/install-sh
  14. # Get the current version number - needed to help build filenames
  15. #
  16. VERS=`cat $srcdir/VERSION`
  17. VERSW=`sed 's/\./_/g' $srcdir/VERSION`
  18. echo "VERSIONS: $VERS $VERSW"
  19. # Start by building an sqlite shell for linux.
  20. #
  21. make clean
  22. make sqlite3.c
  23. CFLAGS="-Os -DSQLITE_ENABLE_FTS3=0 -DSQLITE_ENABLE_RTREE=0"
  24. CFLAGS="$CFLAGS -DSQLITE_THREADSAFE=0"
  25. echo '***** '"COMPILING sqlite3-$VERS.bin..."
  26. gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl
  27. strip sqlite3
  28. mv sqlite3 sqlite3-$VERS.bin
  29. gzip sqlite3-$VERS.bin
  30. chmod 644 sqlite3-$VERS.bin.gz
  31. mv sqlite3-$VERS.bin.gz doc
  32. # Build a source archive useful for windows.
  33. #
  34. make target_source
  35. cd tsrc
  36. echo '***** BUILDING preprocessed source archives'
  37. rm fts[12]* icu*
  38. rm -f ../doc/sqlite-source-$VERSW.zip
  39. zip ../doc/sqlite-source-$VERSW.zip *
  40. cd ..
  41. cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
  42. pwd
  43. zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h
  44. # Build the sqlite.so and tclsqlite.so shared libraries
  45. # under Linux
  46. #
  47. TCLDIR=/home/drh/tcltk/846/linux/846linux
  48. TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
  49. CFLAGS="-Os -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1"
  50. CFLAGS="$CFLAGS -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1"
  51. CFLAGS="$CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1"
  52. echo '***** BUILDING shared libraries for linux'
  53. gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread
  54. strip tclsqlite3.so
  55. chmod 644 tclsqlite3.so
  56. mv tclsqlite3.so tclsqlite-$VERS.so
  57. gzip tclsqlite-$VERS.so
  58. mv tclsqlite-$VERS.so.gz doc
  59. gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread
  60. strip sqlite3.so
  61. chmod 644 sqlite3.so
  62. mv sqlite3.so sqlite-$VERS.so
  63. gzip sqlite-$VERS.so
  64. mv sqlite-$VERS.so.gz doc
  65. # Build the tclsqlite3.dll and sqlite3.dll shared libraries.
  66. #
  67. . $srcdir/mkdll.sh
  68. echo '***** PACKAGING shared libraries for windows'
  69. echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
  70. zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
  71. echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
  72. zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
  73. # Build the sqlite.exe executable for windows.
  74. #
  75. OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
  76. OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1"
  77. i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
  78. -o sqlite3.exe
  79. zip doc/sqlite-$VERSW.zip sqlite3.exe
  80. # Construct a tarball of the source tree
  81. #
  82. echo '***** BUILDING source archive'
  83. ORIGIN=`pwd`
  84. cd $srcdir
  85. cd ..
  86. mv sqlite sqlite-$VERS
  87. EXCLUDE=`find sqlite-$VERS -print | egrep '(www/|art/|doc/|contrib/|_FOSSIL_)' | sed 's,^, --exclude ,'`
  88. echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS"
  89. tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
  90. mv sqlite-$VERS sqlite
  91. cd $ORIGIN
  92. #
  93. # Build RPMS (binary) and Source RPM
  94. #
  95. # Make sure we are properly setup to build RPMs
  96. #
  97. echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
  98. echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
  99. mkdir $HOME/rpm
  100. mkdir $HOME/rpm/BUILD
  101. mkdir $HOME/rpm/SOURCES
  102. mkdir $HOME/rpm/RPMS
  103. mkdir $HOME/rpm/SRPMS
  104. mkdir $HOME/rpm/SPECS
  105. # create the spec file from the template
  106. sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
  107. # copy the source tarball to the rpm directory
  108. cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
  109. # build all the rpms
  110. rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
  111. # copy the RPMs into the build directory.
  112. mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
  113. mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
  114. # Build the website
  115. #
  116. #cp $srcdir/../historical/* doc
  117. #make doc
  118. #cd doc
  119. #chmod 644 *.gz