Commit c7dee039 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Remove minizip from kicad sources. Useless because now (and since a long time)...

Remove minizip from kicad sources. Useless because now (and since a long time) wxWidgets supports full zip file read/write, and minizip build creates problems under Windows, due to zlib not always installed.
parent 0648adda
Loading
Loading
Loading
Loading
+0 −5
Original line number Original line Diff line number Diff line
@@ -12,11 +12,6 @@ endif(WIN32)
# Path to local CMake modules.
# Path to local CMake modules.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)


# Command line option to enable or disable building minizip. Minizip
# building is enabled by default. Use -DKICAD_MINIZIP=OFF to disable
# building minizip.
option(KICAD_MINIZIP "enable/disable building minizip (default ON)" ON)

# Russian GOST patch
# Russian GOST patch
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
option(KICAD_GOST "enable/disable building using GOST notation for multiple gates per package (default OFF)")
+0 −4
Original line number Original line Diff line number Diff line
@@ -52,7 +52,3 @@ endif(APPLE)
install(TARGETS kicad
install(TARGETS kicad
        DESTINATION ${KICAD_BIN}
        DESTINATION ${KICAD_BIN}
        COMPONENT binary)
        COMPONENT binary)

if(KICAD_MINIZIP)
    add_subdirectory(minizip)
endif(KICAD_MINIZIP)
+52 −29
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
#include "fctsys.h"
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"
#include <wx/fs_zip.h>
#include <wx/fs_zip.h>
#include <wx/zipstrm.h>
#include <wx/docview.h>
#include <wx/docview.h>
#include <wx/wfstream.h>
#include <wx/wfstream.h>
#include <wx/zstream.h>
#include <wx/zstream.h>
@@ -107,6 +108,15 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )


void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
{
{
    /* List of file extensions to save. */
    static const wxChar* extentionList[] = {
        wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ),
        wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
        wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ),
        NULL
    };

    wxString msg;
    size_t i;
    size_t i;
    wxFileName fileName = m_ProjectFileName;
    wxFileName fileName = m_ProjectFileName;
    wxString oldPath = wxGetCwd();
    wxString oldPath = wxGetCwd();
@@ -123,17 +133,6 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )


    wxFileName zip = dlg.GetPath();
    wxFileName zip = dlg.GetPath();


    /* List of file extensions to save. */
    static const wxChar* extList[] = {
        wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ),
        wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
        wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ),
        NULL
    };

    wxString cmd = wxT( "-o " );    // run minizip with option -o (overwrite)
    cmd += QuoteFullPath(zip);

    wxString currdirname = wxT( "." );
    wxString currdirname = wxT( "." );
    currdirname += zip.GetPathSeparator();
    currdirname += zip.GetPathSeparator();
    wxDir dir( currdirname );
    wxDir dir( currdirname );
@@ -141,37 +140,61 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
    if( !dir.IsOpened() )
    if( !dir.IsOpened() )
        return;
        return;


    wxString f;
    // Prepare the zip file
    wxString zipfilename = zip.GetFullPath();

    wxFFileOutputStream ostream(zipfilename);
    wxZipOutputStream zipstream( ostream );


    for( i = 0; extList[i] != 0; i++ )
    // Build list of filenames to put in zip archive
    wxString currFilename;
    int zipBytesCnt = 0;    // Size of the zip file
    for( i = 0; extentionList[i] != 0; i++ )
    {
    {
        bool cont = dir.GetFirst( &f, extList[i] );
        bool cont = dir.GetFirst( &currFilename, extentionList[i] );


        while( cont )
        while( cont )
        {
        {
            wxFileName fn( f );
            wxFileSystem fsfile;
            wxString filename = QuoteFullPath(fn);
            PrintMsg( _( "Archive file " ) + currFilename );
            cmd += wxT( " " ) + filename;
            // Read input file and put it in zip file:
            PrintMsg( _( "Archive file " ) + filename + wxT( "\n" ) );
            wxFSFile * infile = fsfile.OpenFile(currFilename);
            cont = dir.GetNext( &f );
            if( infile )
            {
                zipstream.PutNextEntry( currFilename, infile->GetModificationTime() );
                infile->GetStream()->Read( zipstream );
                zipstream.CloseEntry();
                int zippedsize = zipstream.GetSize() - zipBytesCnt;
                zipBytesCnt = zipstream.GetSize();
                PrintMsg( wxT("  ") );
                msg.Printf( _( "(%d bytes, compressed %d bytes)\n"),
                            infile->GetStream()->GetSize(), zippedsize );
                PrintMsg( msg );
                delete infile;
             }
             }
            else
            {
                PrintMsg( _(" >>Error\n") );
            }
            }


#ifdef __WINDOWS__
            cont = dir.GetNext( &currFilename );
#define ZIPPER wxT( "minizip.exe" )
        }
#else
    }
#define ZIPPER wxT( "minizip" )

#endif
    zipBytesCnt = ostream.GetSize();
    if( ExecuteFile( this, ZIPPER, cmd ) >= 0 )
    if( zipstream.Close() )
    {
    {
        wxString msg;
        msg.Printf( _("\nZip archive <%s> created (%d bytes)" ),
        wxString filename = QuoteFullPath(zip);
                    GetChars( zipfilename ), zipBytesCnt );
        msg.Printf( _("\nZip archive <%s> created" ), GetChars( filename ) );
        PrintMsg( msg );
        PrintMsg( msg );
        PrintMsg( wxT( "\n** end **\n" ) );
        PrintMsg( wxT( "\n** end **\n" ) );
    }
    }
    else
    else
        PrintMsg( wxT( "Minizip command error, abort\n" ) );
    {
        msg.Printf( wxT( "Unable to create archive <%s>, abort\n" ),
                  GetChars( zipfilename ) );
        PrintMsg( msg );
    }


    wxSetWorkingDirectory( oldPath );
    wxSetWorkingDirectory( oldPath );
}
}

kicad/minizip/CMakeLists.txt

deleted100644 → 0
+0 −43
Original line number Original line Diff line number Diff line
find_package(ZLIB QUIET)
if(ZLIB_FOUND)
    message(STATUS "Check for installed zlib -- found")
else(ZLIB_FOUND)
    message(STATUS "Check for installed zlib -- not found")
    message(STATUS "Use wxWidgets zlib")

    # zlib is not installed, and in this case wxWidgets creates its own zlib library
    # include files are in ${wxWidgets_ROOT_DIR}/src/zlib
    # and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a)
    # and we try to use it
    # Unfortunately, we have no way to know exactly the path of zlib.h because this file
    # is in wxWidgets sources, not in wxWidgets include path.
    find_path(ZLIB_INCLUDE_DIR
        zlib.h
        PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/
        DOC "location of zlib include files"
        )

    find_file(
        ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a
        ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a
        PATHS ${wxWidgets_ROOT_DIR}/lib/
        PATH_SUFFIXES gcc_lib gcc_dll
        DOC "location of wxzlib library file"
        )
endif(ZLIB_FOUND)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                    ${ZLIB_INCLUDE_DIR})

set(MINIZIP_SRCS
    ioapi.c
    minizip.c
    zip.c)

add_executable(minizip ${MINIZIP_SRCS})

target_link_libraries(minizip ${ZLIB_LIBRARIES})

install(TARGETS minizip
        DESTINATION ${KICAD_BIN}
        COMPONENT binary)
Loading