Skip to content

Commit

Permalink
update build system to generate static and dynamic libraries, correct…
Browse files Browse the repository at this point in the history
… shared library versioning, generate a 'dist dir' as result of a build, populated with include, lib, and bin directories. public domain license on all source and build files not authored by Igor.
  • Loading branch information
lloyd committed Feb 2, 2009
1 parent ae37c02 commit 746a2d3
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 24 deletions.
26 changes: 24 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
cmake_minimum_required(VERSION 2.6)
# Copyright 2009, Lloyd Hilaiel.
#
# License
#
# All the cruft you find here is public domain. You don't have to credit
# anyone to use this code, but my personal request is that you mention
# Igor Pavlov for his hard, high quality work.
#

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(easylzma)

SET (EASYLZMA_MAJOR 0)
SET (EASYLZMA_MINOR 0)
SET (EASYLZMA_MICRO 1)

SET (EASYLZMA_DIST_NAME
"easylzma-${EASYLZMA_MAJOR}.${EASYLZMA_MINOR}.${EASYLZMA_MICRO}")

IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF (NOT CMAKE_BUILD_TYPE)

IF (${CMAKE_BUILD_TYPE} STREQUAL "Release")
MESSAGE("** for a debug build: cmake -DCMAKE_BUILD_TYPE=Debug ..")
ENDIF (${CMAKE_BUILD_TYPE} STREQUAL "Release")

SET(CMAKE_C_FLAGS "-Wall")
IF (WIN32)
SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
Expand Down
9 changes: 9 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
How to build (and eventually install) the easylzma library and
bundled command line tools

1. get cmake version 2.6 or greater
2. mkdir build
3. cd build
4. cmake ..
5. make
6. build output is in build/easylzma-x.y.z/ *
13 changes: 12 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(this project is just getting started. nothing to see here. move along)
Overview

Easylzma is a C library and command line tools for LZMA compression and
decompression. It uses a Igor Pavlov's reference implementation and SDK
written in C.

License

Expand All @@ -17,6 +21,13 @@ Project Goals
4. easy to build and use everywhere (doze and nix alike)
5. public domain licensing through and through. (hats off to Igor)

Current State:

THIS IS A WORK IN PROGRESS. The code here should be considered pre-alpha,
and this should only be used by tinkerers or hackers at this point. Once
feature completion is attained this message will be updated. See the
TODO file distributed with the source for remaining work to be done.

Features

XXX: write me (and the code)
Expand Down
13 changes: 13 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
1. 7zip format support
2. complete test suite
a. command line invocation tests
b. round trip tests with lzmautils and lzip utils
(only run when other tools present and in path)
c. bad input tests with lzma files corrupted in various ways
3. stdout/stdin support
4. multiple files on command line
5. optimal lzma parameter discovery
6. example code
7. doxygen output - html and man pages
8. preservation of permissions
9. --keep and --force flags functioning properly
28 changes: 24 additions & 4 deletions elzma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
# Copyright 2009, Lloyd Hilaiel.
#
# License
#
# All the cruft you find here is public domain. You don't have to credit
# anyone to use this code, but my personal request is that you mention
# Igor Pavlov for his hard, high quality work.
#

# set up some paths
SET (binDir ${CMAKE_CURRENT_BINARY_DIR}/../${EASYLZMA_DIST_NAME}/bin)

# create some directories
FILE(MAKE_DIRECTORY ${binDir})

SET (SRCS elzma.c)
SET (HDRS )

# use the library we built
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../src/dist/include)
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../src/dist/lib)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/../${EASYLZMA_DIST_NAME}/include
)
LINK_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/../${EASYLZMA_DIST_NAME}/lib
)

ADD_EXECUTABLE(elzma ${SRCS})

TARGET_LINK_LIBRARIES(elzma easylzma_s)

# make a hard link (or copy) from unelzma to elzma
# XXX port me to doze
GET_TARGET_PROPERTY(binPath elzma LOCATION)
ADD_CUSTOM_COMMAND(TARGET elzma POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir}
COMMAND ln -f elzma unelzma
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
WORKING_DIRECTORY ${binDir})
10 changes: 9 additions & 1 deletion elzma/elzma.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
/**
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*
* command line elzma tool for lzma compression
*
* At time of writing, the primary purpose of this tool is to test the
Expand Down
35 changes: 23 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
cmake_minimum_required(VERSION 2.6)
# Copyright 2009, Lloyd Hilaiel.
#
# License
#
# All the cruft you find here is public domain. You don't have to credit
# anyone to use this code, but my personal request is that you mention
# Igor Pavlov for his hard, high quality work.
#

FILE(GLOB SRCS pavlov/*.c *.c)
FILE(GLOB HDRS *.h pavlov/*.h easylzma/*.h)
FILE(GLOB PUB_HDRS easylzma/*.h)

# (XXX temporarily include Igor's headers in output dir)
FILE(GLOB TMP_HDRS
pavlov/LzmaLib.h pavlov/Types.h pavlov/LzmaDec.h pavlov/LzmaEnc.h)
SET(PUB_HDRS ${PUB_HDRS} ${TMP_HDRS})

# set up some paths for outputing the usable binaries
SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/dist/lib)
SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/dist/include/easylzma)
SET (libDir
${CMAKE_CURRENT_BINARY_DIR}/../${EASYLZMA_DIST_NAME}/lib)
SET (incDir
${CMAKE_CURRENT_BINARY_DIR}/../${EASYLZMA_DIST_NAME}/include/easylzma)

# an include directory to allow easylzma implementation to find public
# headers
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

# create these output directories
FILE(MAKE_DIRECTORY ${libDir})
FILE(MAKE_DIRECTORY ${incDir})

# get the built libs into the correct place
SET(LIBRARY_OUTPUT_PATH ${libDir})

ADD_LIBRARY(easylzma_s STATIC ${SRCS} ${HDRS})
ADD_LIBRARY(easylzma SHARED ${SRCS} ${HDRS})

# setup shared library version numbering
SET_TARGET_PROPERTIES(
easylzma PROPERTIES
SOVERSION ${EASYLZMA_MAJOR}
VERSION ${EASYLZMA_MAJOR}.${EASYLZMA_MINOR}.${EASYLZMA_MICRO})

# create these output directories
FILE(MAKE_DIRECTORY ${libDir})
FILE(MAKE_DIRECTORY ${incDir})

### copy the two required headers into our output dir as a post build step
# copy public headers to output directory
Expand Down
10 changes: 10 additions & 0 deletions src/common_internal.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*/

#include "common_internal.h"

static void *elzmaAlloc(void *p, size_t size) {
Expand Down
10 changes: 10 additions & 0 deletions src/compress.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*/

#include "easylzma/compress.h"
#include "lzma_header.h"
#include "common_internal.h"
Expand Down
11 changes: 10 additions & 1 deletion src/decompress.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*/

#include "easylzma/decompress.h"
#include "pavlov/LzmaDec.h"
#include "common_internal.h"
Expand Down Expand Up @@ -148,4 +158,3 @@ elzma_decompress_run(elzma_decompress_handle hand,

return errorCode;
}

13 changes: 13 additions & 0 deletions src/easylzma/common.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*
* easylzma/common.h - definitions common to both compression and
* decompression
*/

#ifndef __EASYLZMACOMMON_H__
#define __EASYLZMACOMMON_H__

Expand Down
12 changes: 12 additions & 0 deletions src/easylzma/compress.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*
* easylzma/compress.h - the API for LZMA compression using easylzma
*/

#ifndef __EASYLZMACOMPRESS_H__
#define __EASYLZMACOMPRESS_H__

Expand Down
12 changes: 12 additions & 0 deletions src/easylzma/decompress.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*
* easylzma/decompress.h - The API for LZMA decompression using easylzma
*/

#ifndef __EASYLZMADECOMPRESS_H__
#define __EASYLZMADECOMPRESS_H__

Expand Down
14 changes: 11 additions & 3 deletions src/lzma_header.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/* code showing us how to parse "proper" lzma file headers.
* we need to augment with stuff to read and write these 13 byte
* headers simply. */
/*
* Copyright 2009, Lloyd Hilaiel.
*
* License
*
* All the cruft you find here is public domain. You don't have to credit
* anyone to use this code, but my personal request is that you mention
* Igor Pavlov for his hard, high quality work.
*/

/* XXX: clean this up, it's mostly lifted from pavel */

#include "lzma_header.h"

Expand Down

0 comments on commit 746a2d3

Please sign in to comment.