publish.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #!/bin/sh
  2. #
  3. # This script is used to compile SQLite and all its documentation and
  4. # ship everything up to the SQLite website. This script will only work
  5. # on the system "zadok" at the Hwaci offices. But others might find
  6. # the script useful as an example.
  7. #
  8. # Set srcdir to the name of the directory that contains the publish.sh
  9. # script.
  10. #
  11. srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
  12. # Get the makefile.
  13. #
  14. cp $srcdir/Makefile.template ./Makefile
  15. # Start building stuff.
  16. #
  17. make clean
  18. make sqlite
  19. strip sqlite
  20. mv sqlite sqlite.bin
  21. rm -f sqlite.bin.gz
  22. gzip sqlite.bin
  23. # Build the tclsqlite.so shared library for import into tclsh or wish
  24. # under Linux
  25. #
  26. make target_source
  27. rm sqlite_source.zip
  28. cd tsrc
  29. zip ../sqlite_source.zip *
  30. rm shell.c
  31. TCLDIR=/home/drh/tcltk/8.2linux
  32. TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
  33. OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
  34. gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
  35. strip tclsqlite.so
  36. mv tclsqlite.so ..
  37. rm tclsqlite.c
  38. gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
  39. strip sqlite.so
  40. mv sqlite.so ..
  41. cd ..
  42. rm -f tclsqlite.so.gz sqlite.so.gz
  43. gzip tclsqlite.so
  44. gzip sqlite.so
  45. # Build the tclsqlite.dll shared library that can be imported into tclsh
  46. # or wish on windows.
  47. #
  48. make target_source
  49. cd tsrc
  50. rm shell.c
  51. TCLDIR=/home/drh/tcltk/8.2win
  52. TCLSTUBLIB=$TCLDIR/tclstub82.a
  53. PATH=$PATH:/opt/mingw/bin
  54. OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
  55. CC="i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR"
  56. rm shell.c
  57. for i in *.c; do
  58. CMD="$CC -c $i"
  59. echo $CMD
  60. $CMD
  61. done
  62. echo 'EXPORTS' >tclsqlite.def
  63. echo 'Tclsqlite_Init' >>tclsqlite.def
  64. echo 'Sqlite_Init' >>tclsqlite.def
  65. i386-mingw32-dllwrap \
  66. --def tclsqlite.def -v --export-all \
  67. --driver-name i386-mingw32-gcc \
  68. --dlltool-name i386-mingw32-dlltool \
  69. --as i386-mingw32-as \
  70. --target i386-mingw32 \
  71. -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
  72. i386-mingw32-strip tclsqlite.dll
  73. mv tclsqlite.dll ..
  74. rm tclsqlite.o
  75. cat >sqlite.def <<\END_OF_FILE
  76. EXPORTS
  77. sqlite_open
  78. sqlite_close
  79. sqlite_exec
  80. sqlite_last_insert_rowid
  81. sqlite_error_string
  82. sqlite_interrupt
  83. sqlite_complete
  84. sqlite_busy_handler
  85. sqlite_busy_timeout
  86. sqlite_get_table
  87. sqlite_free_table
  88. sqlite_mprintf
  89. sqlite_vmprintf
  90. sqlite_exec_printf
  91. sqlite_exec_vprintf
  92. sqlite_get_table_printf
  93. sqlite_get_table_vprintf
  94. sqlite_freemem
  95. sqlite_libversion
  96. sqlite_libencoding
  97. sqlite_changes
  98. sqliteMalloc
  99. sqliteFree
  100. sqliteRealloc
  101. END_OF_FILE
  102. i386-mingw32-dllwrap \
  103. --def sqlite.def -v --export-all \
  104. --driver-name i386-mingw32-gcc \
  105. --dlltool-name i386-mingw32-dlltool \
  106. --as i386-mingw32-as \
  107. --target i386-mingw32 \
  108. -dllname sqlite.dll -lmsvcrt *.o
  109. i386-mingw32-strip sqlite.dll
  110. mv sqlite.dll sqlite.def ..
  111. cd ..
  112. rm -f tclsqlite.zip sqlitedll.zip
  113. zip tclsqlite.zip tclsqlite.dll
  114. zip sqlitedll.zip sqlite.dll sqlite.def
  115. # Build the sqlite.exe executable for windows.
  116. #
  117. make target_source
  118. cd tsrc
  119. rm tclsqlite.c
  120. OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
  121. i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
  122. mv sqlite.exe ..
  123. cd ..
  124. rm -f sqlite.zip
  125. zip sqlite.zip sqlite.exe
  126. # Construct a tarball of the source tree
  127. #
  128. ORIGIN=`pwd`
  129. cd $srcdir
  130. cd ..
  131. EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
  132. tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite
  133. cd $ORIGIN
  134. vers=`cat $srcdir/VERSION`
  135. rm -f sqlite-$vers.tar.gz
  136. ln sqlite.tar.gz sqlite-$vers.tar.gz
  137. #
  138. # Build RPMS (binary) and Source RPM
  139. #
  140. # Make sure we are properly setup to build RPMs
  141. #
  142. echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
  143. echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
  144. mkdir $HOME/rpm
  145. mkdir $HOME/rpm/BUILD
  146. mkdir $HOME/rpm/SOURCES
  147. mkdir $HOME/rpm/RPMS
  148. mkdir $HOME/rpm/SRPMS
  149. mkdir $HOME/rpm/SPECS
  150. # create the spec file from the template
  151. sed s/SQLITE_VERSION/$vers/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
  152. # copy the source tarball to the rpm directory
  153. cp sqlite-$vers.tar.gz $HOME/rpm/SOURCES/.
  154. # build all the rpms
  155. rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
  156. # copy the RPMs into the build directory.
  157. ln $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm .
  158. ln $HOME/rpm/SRPMS/sqlite-$vers*.rpm .
  159. # Build the website
  160. #
  161. cp $srcdir/../historical/* .
  162. rm -rf doc
  163. make doc
  164. ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc
  165. ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc
  166. ln *.rpm doc