mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 06:03:40 +00:00
66 lines
3.4 KiB
Diff
66 lines
3.4 KiB
Diff
|
diff -r 6d5130e4ae52 sqlite/CMakeLists.txt
|
||
|
--- a/sqlite/CMakeLists.txt Sun Sep 10 18:53:00 2017 +0200
|
||
|
+++ b/sqlite/CMakeLists.txt Fri Sep 15 00:12:11 2017 -0700
|
||
|
@@ -1,62 +1,5 @@
|
||
|
cmake_minimum_required( VERSION 2.4 )
|
||
|
|
||
|
-# [BB/EP] Download SQLite archive and extract the sources if necessary.
|
||
|
-set( ZAN_SQLITE_VERSION 3180000 ) # SQL version 3.18.0
|
||
|
-set( ZAN_SQLITE_YEAR 2017 )
|
||
|
-set( ZAN_SQLITE_SHA1 "74559194e1dd9b9d577cac001c0e9d370856671b" )
|
||
|
-set( ZAN_SQLITE_DOWNLOAD_NAME "sqlite-autoconf-${ZAN_SQLITE_VERSION}" )
|
||
|
-set( ZAN_SQLITE_TEMP_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz" )
|
||
|
-set( ZAN_SQLITE_HASHED_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/sqlite-${ZAN_SQLITE_SHA1}.tar.gz" )
|
||
|
-
|
||
|
-if( IS_DIRECTORY ${ZAN_SQLITE_HASHED_ARCHIVE} OR IS_SYMLINK ${ZAN_SQLITE_HASHED_ARCHIVE} )
|
||
|
- message( FATAL_ERROR "SQLite: ${ZAN_SQLITE_HASHED_ARCHIVE} must be a valid file.\n"
|
||
|
- "SQLite: Please remove it and try again." )
|
||
|
-elseif( NOT EXISTS ${ZAN_SQLITE_HASHED_ARCHIVE} )
|
||
|
-
|
||
|
- if( IS_DIRECTORY ${ZAN_SQLITE_TEMP_ARCHIVE} OR IS_SYMLINK ${ZAN_SQLITE_TEMP_ARCHIVE} )
|
||
|
- message( FATAL_ERROR "SQLite: ${ZAN_SQLITE_TEMP_ARCHIVE} must be a valid file.\n"
|
||
|
- "SQLite: Please remove it and try again." )
|
||
|
- endif()
|
||
|
- message( STATUS "SQLite: downloading the archive..." )
|
||
|
-
|
||
|
- file( DOWNLOAD https://www.sqlite.org/${ZAN_SQLITE_YEAR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz ${ZAN_SQLITE_TEMP_ARCHIVE}
|
||
|
- SHOW_PROGRESS
|
||
|
- STATUS ZAN_SQLITE_DOWNLOAD_STATUS )
|
||
|
-
|
||
|
- # Report any problem if present and abort immediately.
|
||
|
- list( GET ZAN_SQLITE_DOWNLOAD_STATUS 0 ZAN_SQLITE_DOWNLOAD_ERROR_CODE )
|
||
|
- if( ZAN_SQLITE_DOWNLOAD_ERROR_CODE )
|
||
|
- list( GET ZAN_SQLITE_DOWNLOAD_STATUS 1 ZAN_SQLITE_DOWNLOAD_ERROR_MESSAGE )
|
||
|
- message( FATAL_ERROR "SQLite: download failed. Reason: ${ZAN_SQLITE_DOWNLOAD_ERROR_MESSAGE}" )
|
||
|
- endif()
|
||
|
-
|
||
|
- # Check the hash. Abort immediately if it's not valid (something is wrong with the download)
|
||
|
- file( SHA1 ${ZAN_SQLITE_TEMP_ARCHIVE} ZAN_SQLITE_CURRENT_SHA1 )
|
||
|
- if( NOT ZAN_SQLITE_CURRENT_SHA1 STREQUAL ZAN_SQLITE_SHA1 )
|
||
|
- message( FATAL_ERROR "SQLite: download failed. The downloaded file has a different hash:\n"
|
||
|
- "SQLite: valid: ${ZAN_SQLITE_SHA1}\n"
|
||
|
- "SQLite: downloaded: ${ZAN_SQLITE_CURRENT_SHA1}" )
|
||
|
- endif()
|
||
|
-
|
||
|
- message( STATUS "SQLite: saving the source files into the 'sqlite' directory." )
|
||
|
-
|
||
|
- # Rename the archive.
|
||
|
- execute_process( COMMAND ${CMAKE_COMMAND} -E rename ${ZAN_SQLITE_TEMP_ARCHIVE} ${ZAN_SQLITE_HASHED_ARCHIVE} )
|
||
|
-
|
||
|
- # Extract the archive.
|
||
|
- execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${ZAN_SQLITE_HASHED_ARCHIVE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
|
||
|
-
|
||
|
- # Copy the required files.
|
||
|
- execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3.c ${CMAKE_CURRENT_SOURCE_DIR} )
|
||
|
- execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3.h ${CMAKE_CURRENT_SOURCE_DIR} )
|
||
|
- execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3ext.h ${CMAKE_CURRENT_SOURCE_DIR} )
|
||
|
-
|
||
|
- # Remove the extracted folder.
|
||
|
- execute_process( COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME} )
|
||
|
-
|
||
|
- message( STATUS "SQLite: done." )
|
||
|
-endif()
|
||
|
-
|
||
|
add_library( sqlite3 sqlite3.c )
|
||
|
target_link_libraries( sqlite3 ${CMAKE_DL_LIBS} )
|