summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-07-19 22:05:57 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2012-07-19 22:05:57 +0200
commitea3de25ff722577efcf32f70d9bbda4b4b0ab2c0 (patch)
treeaacd22b2d30a2c5664b99b490fbcec57aa55d812
parent711f6fb1caa0861d1b3504d53c7f44c0582cbc97 (diff)
downloadalpine-usb-creator-ea3de25ff722577efcf32f70d9bbda4b4b0ab2c0.tar.bz2
alpine-usb-creator-ea3de25ff722577efcf32f70d9bbda4b4b0ab2c0.tar.xz
Make libuniso compile on windows
-rw-r--r--Alpine Linux USB Creator.dev29
-rw-r--r--Alpine Linux USB Creator.layout8
-rw-r--r--Makefile.win11
-rw-r--r--libuniso.c19
4 files changed, 55 insertions, 12 deletions
diff --git a/Alpine Linux USB Creator.dev b/Alpine Linux USB Creator.dev
index fb73570..b750624 100644
--- a/Alpine Linux USB Creator.dev
+++ b/Alpine Linux USB Creator.dev
@@ -1,7 +1,7 @@
[Project]
FileName=Alpine Linux USB Creator.dev
Name=Alpine Linux USB Creator
-UnitCount=8
+UnitCount=10
PchHead=-1
PchSource=-1
Ver=3
@@ -37,7 +37,7 @@ Folder=Alpine Linux USB Creator
Compile=1
Link=1
Priority=1000
-OverrideBuildCmd=0
+OverrideBuildCmd=1
BuildCmd=
[Unit4]
@@ -88,6 +88,7 @@ ProductName=
ProductVersion=
AutoIncBuildNrOnRebuild=0
AutoIncBuildNrOnCompile=0
+UnitCount=10
[Profile1]
ProfileName=MingW gcc
@@ -100,14 +101,14 @@ MakeIncludes=
Compiler=
CppCompiler=
Linker=-mwindows_@@_-l$(WXLIBNAME)_@@_-l$(WXLIBNAME)_gl_@@_-lwxscintilla_@@_-lwxtiff_@@_-lwxjpeg_@@_-lwxpng_@@_-lwxzlib_@@_-lwxregexu_@@_-lwxexpat_@@_-lkernel32_@@_-luser32_@@_-lgdi32_@@_-lcomdlg32_@@_-lwinspool_@@_-lwinmm_@@_-lshell32_@@_-lcomctl32_@@_-lole32_@@_-loleaut32_@@_-luuid_@@_-lrpcrt4_@@_-ladvapi32_@@_-lwsock32_@@_-lodbc32_@@_-lopengl32_@@_
-PreprocDefines=__WXMSW___@@___GNUWIN32___@@__UNICODE
+PreprocDefines=__WXMSW___@@___GNUWIN32___@@__UNICODE_@@_
CompilerSettings=0000000000000001000000
Icon=
ExeOutput=Output\MingW
ImagesOutput=Images\
ObjectOutput=Objects\MingW
OverrideOutput=0
-OverrideOutputName=
+OverrideOutputName=Alpine Linux USB Creator.exe
HostApplication=
CommandLine=
UseCustomMakefile=0
@@ -165,3 +166,23 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
+[Unit9]
+FileName=libuniso.c
+CompileCpp=0
+Folder=Alpine Linux USB Creator
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit10]
+FileName=uniso.h
+CompileCpp=0
+Folder=Alpine Linux USB Creator
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
diff --git a/Alpine Linux USB Creator.layout b/Alpine Linux USB Creator.layout
index 10a373d..ef9fc3b 100644
--- a/Alpine Linux USB Creator.layout
+++ b/Alpine Linux USB Creator.layout
@@ -4,8 +4,8 @@ Order=0,1,2
[Editor_0]
Open=1
Top=1
-CursorCol=2
-CursorRow=1
+CursorCol=7
+CursorRow=10
TopLine=1
LeftChar=1
[Editor_1]
@@ -18,8 +18,8 @@ LeftChar=1
[Editor_2]
Open=1
Top=0
-CursorCol=1
-CursorRow=8
+CursorCol=20
+CursorRow=2
TopLine=1
LeftChar=1
[Editor_3]
diff --git a/Makefile.win b/Makefile.win
index 7c0d734..613c2b8 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -1,14 +1,14 @@
# Project: Alpine Linux USB Creator
# Compiler: Default GCC compiler
# Compiler Type: MingW 3
-# Makefile created by wxDev-C++ IDE 7.4.2.569 on 17/07/12 19:58
+# Makefile created by wxDev-C++ IDE 7.4.2.569 on 19/07/12 21:49
WXLIBNAME = wxmsw29u
CPP = g++.exe
CC = gcc.exe
WINDRES = "windres.exe"
-OBJ = Objects/MingW/dialog.o Objects/MingW/main.o Objects/MingW/dialog_ui.o Objects/MingW/creator_thread.o
-LINKOBJ = "Objects/MingW/dialog.o" "Objects/MingW/main.o" "Objects/MingW/dialog_ui.o" "Objects/MingW/creator_thread.o"
+OBJ = Objects/MingW/dialog.o Objects/MingW/main.o Objects/MingW/dialog_ui.o Objects/MingW/creator_thread.o Objects/MingW/libuniso.o
+LINKOBJ = "Objects/MingW/dialog.o" "Objects/MingW/main.o" "Objects/MingW/dialog_ui.o" "Objects/MingW/creator_thread.o" "Objects/MingW/libuniso.o"
LIBS = -L"C:/Program Files/Dev-Cpp/lib/wx/gcc_lib" -L"C:/Program Files/Dev-Cpp/lib" -L"C:/Program Files/Dev-Cpp/MinGW32/lib" -mwindows -l$(WXLIBNAME) -l$(WXLIBNAME)_gl -lwxscintilla -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32 -g3
INCS = -I"C:/Program Files/Dev-Cpp/MinGW32/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW32/include" -I"C:/Program Files/Dev-Cpp/" -I"C:/Program Files/Dev-Cpp/include/common"
@@ -45,5 +45,8 @@ Objects/MingW/main.o: $(GLOBALDEPS) main.cpp main.h dialog.h dialog_ui.h
Objects/MingW/dialog_ui.o: $(GLOBALDEPS) dialog_ui.cpp dialog_ui.h
$(CPP) -c dialog_ui.cpp -o Objects/MingW/dialog_ui.o $(CXXFLAGS)
-Objects/MingW/creator_thread.o: $(GLOBALDEPS) creator_thread.cpp creator_thread.h dialog.h dialog_ui.h
+Objects/MingW/creator_thread.o: $(GLOBALDEPS) creator_thread.cpp creator_thread.h dialog.h dialog_ui.h uniso.h
$(CPP) -c creator_thread.cpp -o Objects/MingW/creator_thread.o $(CXXFLAGS)
+
+Objects/MingW/libuniso.o: $(GLOBALDEPS) libuniso.c uniso.h
+ $(CC) -c libuniso.c -o Objects/MingW/libuniso.o $(CFLAGS)
diff --git a/libuniso.c b/libuniso.c
index ef0b9ef..a71a1ae 100644
--- a/libuniso.c
+++ b/libuniso.c
@@ -28,7 +28,20 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#if defined(_WIN32) || \
+ ( defined(__MWERKS__) && defined(__INTEL__) ) // windows case
+#define __LITTLE_ENDIAN 1234
+#define __BYTE_ORDER __LITTLE_ENDIAN
+
+#define mkdir(x,y) mkdir(x)
+#define u_int16_t uint16_t
+#define u_int32_t uint32_t
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+#define be16toh(x) x = ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
+
+#else
#include <endian.h>
+#endif
#include <sys/stat.h>
#include "uniso.h"
@@ -228,6 +241,9 @@ static void update_progress(struct uniso_context *ctx)
static int do_splice(struct uniso_context *ctx, int to_fd, int bytes)
{
+#if defined(_WIN32)
+ return -1;
+#else
int r;
do {
@@ -242,6 +258,7 @@ static int do_splice(struct uniso_context *ctx, int to_fd, int bytes)
} while (bytes != 0);
return 0;
+#endif
}
static int do_read(struct uniso_context *ctx, unsigned char *buf, int bytes)
@@ -388,8 +405,10 @@ static int link_or_clone(const char *src, const char *dst, size_t bytes)
int r;
static char buf[ISOFS_TMPBUF_SIZE];
+#if !defined(_WIN32)
if (link(src, dst) == 0)
return 0;
+#endif
src_fd = open(src, O_RDONLY);
if (src_fd < 0)