Skip to content

Commit

Permalink
Add builddeb rules to make the deb packages
Browse files Browse the repository at this point in the history
  • Loading branch information
trufanov-nok committed Mar 17, 2021
1 parent 60a9b21 commit 35a9c1e
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 38 deletions.
76 changes: 39 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ SET(

PROJECT("FreeImage version of c44 encoder")

SET(CMAKE_BUILD_TYPE "Release") # builddeb won't compile with "None"

# should point to DjVuLibre sources
SET(djvu_libre_sources_path "./djvulibre/")
SET(libdjvu "${djvu_libre_sources_path}libdjvu/" )
Expand All @@ -34,18 +36,18 @@ IF(CMAKE_COMPILER_IS_GNUCC)
ENDIF(CMAKE_COMPILER_IS_GNUCC)

IF(UNIX)
FindPthreads()
IF(PTHREADS_FOUND)
ADD_DEFINITIONS(${PTHREADS_CFLAGS})
LINK_LIBRARIES(${PTHREADS_LIBS})
add_compile_definitions(HAVE_PTHREAD)
ELSE(PTHREADS_FOUND)
MESSAGE(
FATAL_ERROR
"Could not detect threading flags.\n"
"Try specifying them manually in PTHREADS_CFLAGS and PTHREADS_LIBS."
)
ENDIF(PTHREADS_FOUND)
FindPthreads()
IF(PTHREADS_FOUND)
ADD_DEFINITIONS(${PTHREADS_CFLAGS})
LINK_LIBRARIES(${PTHREADS_LIBS})
add_definitions(-DHAVE_PTHREAD)
ELSE(PTHREADS_FOUND)
MESSAGE(
FATAL_ERROR
"Could not detect threading flags.\n"
"Try specifying them manually in PTHREADS_CFLAGS and PTHREADS_LIBS."
)
ENDIF(PTHREADS_FOUND)
ELSEIF(WIN32)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(UNIX)
Expand All @@ -56,34 +58,34 @@ IF(NOT HAVE_STDINT_H)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
ELSE(NOT HAVE_STDINT_H)
FILE(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/stdint.h")
add_compile_definitions(HAVE_STDINT_H)
add_definitions(-DHAVE_STDINT_H)
ENDIF(NOT HAVE_STDINT_H)

#some required params which aren't checked in hope your system have them
add_compile_definitions(HAVE_STDINCLUDES HAS_WCHAR HAVE_MBSTATE_T HAVE_NAMESPACES)
add_definitions(-DHAVE_STDINCLUDES -DHAS_WCHAR -DHAVE_MBSTATE_T -DHAVE_NAMESPACES)

FIND_PATH(
FI_INCLUDE_DIR FreeImage.h
PATHS /usr/local/include /usr/include
DOC "Path to libfreeimage headers."
PATHS /usr/local/include /usr/include
DOC "Path to libfreeimage headers."
)
IF(NOT FI_INCLUDE_DIR)
MESSAGE(
FATAL_ERROR
"Could not find libfreeimage headers.\n"
"You may need to install a package named libfreeimage-dev or similarly."
)
FATAL_ERROR
"Could not find libfreeimage headers.\n"
"You may need to install a package named libfreeimage-dev or similarly."
)
ENDIF()

INCLUDE_DIRECTORIES("${FI_INCLUDE_DIR}"
INCLUDE_DIRECTORIES("${FI_INCLUDE_DIR}"
"${djvu_libre_sources_path}libdjvu/" # should contain GString.h etc.
"${djvu_libre_sources_path}tools/" # should contain common.h
"${djvu_libre_sources_path}tools/" # should contain common.h
)

FIND_LIBRARY(
FI_LIBRARY freeimage
PATHS /usr/local/lib /usr/lib
DOC "Path to libfreeimage library."
PATHS /usr/local/lib /usr/lib
DOC "Path to libfreeimage library."
)
IF(NOT FI_LIBRARY)
MESSAGE(
Expand All @@ -95,16 +97,16 @@ ENDIF()

SET(
djvu_libre_sources
${libdjvu}Arrays.cpp ${libdjvu}ByteStream.cpp
${libdjvu}DjVuFile.cpp ${libdjvu}DjVuInfo.cpp
${libdjvu}DjVuMessage.cpp ${libdjvu}DjVuMessageLite.cpp
${libdjvu}GBitmap.cpp ${libdjvu}GContainer.cpp ${libdjvu}GException.cpp
${libdjvu}GOS.cpp ${libdjvu}GPixmap.cpp ${libdjvu}GRect.cpp ${libdjvu}GSmartPointer.cpp
${libdjvu}GString.cpp ${libdjvu}GThreads.cpp ${libdjvu}GURL.cpp ${libdjvu}GUnicode.cpp
${libdjvu}IFFByteStream.cpp ${libdjvu}IW44EncodeCodec.cpp ${libdjvu}IW44Image.cpp
${libdjvu}JB2EncodeCodec.cpp
${libdjvu}MMX.cpp ${libdjvu}UnicodeByteStream.cpp ${libdjvu}XMLParser.cpp ${libdjvu}XMLTags.cpp
${libdjvu}ZPCodec.cpp
${libdjvu}Arrays.cpp ${libdjvu}ByteStream.cpp
${libdjvu}DjVuFile.cpp ${libdjvu}DjVuInfo.cpp
${libdjvu}DjVuMessage.cpp ${libdjvu}DjVuMessageLite.cpp
${libdjvu}GBitmap.cpp ${libdjvu}GContainer.cpp ${libdjvu}GException.cpp
${libdjvu}GOS.cpp ${libdjvu}GPixmap.cpp ${libdjvu}GRect.cpp ${libdjvu}GSmartPointer.cpp
${libdjvu}GString.cpp ${libdjvu}GThreads.cpp ${libdjvu}GURL.cpp ${libdjvu}GUnicode.cpp
${libdjvu}IFFByteStream.cpp ${libdjvu}IW44EncodeCodec.cpp ${libdjvu}IW44Image.cpp
${libdjvu}JB2EncodeCodec.cpp
${libdjvu}MMX.cpp ${libdjvu}UnicodeByteStream.cpp ${libdjvu}XMLParser.cpp ${libdjvu}XMLTags.cpp
${libdjvu}ZPCodec.cpp
)

SET(
Expand All @@ -115,13 +117,13 @@ SET(

IF (WIN32)
ADD_EXECUTABLE( c44-fi WIN32 ${sources} ${djvu_libre_sources})
add_compile_definitions(_WIN32)
add_definitions(-D_WIN32)
ELSEIF(APPLE)
ADD_EXECUTABLE( c44-fi MACOSX_BUNDLE ${sources} ${djvu_libre_sources})
add_compile_definitions(macintosh)
add_definitions(-Dmacintosh)
ELSE()
ADD_EXECUTABLE( c44-fi ${sources} ${djvu_libre_sources})
add_compile_definitions(UNIX)
add_definitions(-DUNIX)
ENDIF()

TARGET_LINK_LIBRARIES(
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
c44-freeimage (3.5.28-0ubuntu1) bionic; urgency=medium

* First release on launchpad

-- Alexander Trufanov <[email protected]> Wed, 17 Mar 2021 10:40:00 +0300
16 changes: 16 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: c44-freeimage
Section: graphics
Priority: optional
Maintainer: Alexander Trufanov <[email protected]>
Build-Depends: debhelper-compat (= 9), libgcc1 (>=1.3.0), libc6 (>=2.14), libpng-dev (>=1.6.2), libstdc++6 (>=5.2), cmake (>=2.8.9), libfreeimage-dev (>=3.17)
Standards-Version: 4.5.0
Homepage: https://github.com/trufanov-nok/c44-freeimage
#Vcs-Browser: https://salsa.debian.org/debian/scantailor-universal
#Vcs-Git: https://salsa.debian.org/debian/scantailor-universal.git
Rules-Requires-Root: no

Package: c44-freeimage
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Fork of c44 encoder from DjVuLibre that supports most
of the common image formats with help of FreeImage library.
7 changes: 7 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/trufanov-nok/c44-freeimage

Files: *
Copyright: 2002 Leon Bottou and Yann Le Cun.
2001 AT&T
License: GPL-2+
9 changes: 9 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/make -f

export DH_VERBOSE=1

%:
dh $@

#override_dh_auto_configure:
# git config --system http.sslVerify false && git clone https://github.com/barak/djvulibre.git && dh_auto_configure
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
2 changes: 1 addition & 1 deletion src/c44-fi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ FreeImage error handler
void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) {
printf("\n*** ");
printf("%s Format\n", FreeImage_GetFormatFromFIF(fif));
printf(message);
printf("%s", message);
printf(" ***\n");
}

Expand Down

0 comments on commit 35a9c1e

Please sign in to comment.