Skip to content

Commit

Permalink
build scripts make and zip also the windows plugin dll
Browse files Browse the repository at this point in the history
  • Loading branch information
prof7bit committed Jun 16, 2012
1 parent 22a0f23 commit 50f3c8d
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@
*.exe *.exe
*.map *.map
*.tar.bz2 *.tar.bz2
*.zip
src/gui/lib src/gui/lib
src/purple/lib src/purple/lib
src/tools/lib src/tools/lib
Expand Down
4 changes: 2 additions & 2 deletions src/purple/Makefile
Expand Up @@ -30,8 +30,8 @@ clean:




## this is only for making the preview ## this is only for making the preview
## binary that I upload to github ## binaries that I upload to github
demo: demo:
mkdir -p lib mkdir -p lib
fpc $(FPCOPT) -dDebugToConsole -dDebugToFile purpletorchat.lpr fpc $(FPCOPT) -dDebugToConsole -dDebugToFile purpletorchat.lpr

fpc -Twin32 $(FPCOPT) -dDebugToConsole -dDebugToFile purpletorchat.lpr
44 changes: 32 additions & 12 deletions src/tools/filetools.pas
Expand Up @@ -11,10 +11,16 @@ function FCopy(A,B: String): Boolean;
function FMkDir(D: String): Boolean; function FMkDir(D: String): Boolean;
function FDelete(D: String): Boolean; function FDelete(D: String): Boolean;
function FRename(A, B: String): Boolean; function FRename(A, B: String): Boolean;
function FTar(A: String; F: array of AnsiString): String; // returns the archive name
function FZip(A: String; F: array of AnsiString): String; // returns the archive name function FZip(A: String; F: array of AnsiString): String; // returns the archive name



implementation implementation


const
TAR_EXE = '/bin/tar';
ZIP_EXE = '/usr/bin/zip';

function FCopy(A, B: String): Boolean; function FCopy(A, B: String): Boolean;
var var
Fa: TFileStream = nil; Fa: TFileStream = nil;
Expand All @@ -37,12 +43,12 @@ function FCopy(A, B: String): Boolean;
except except
Result := False; Result := False;
if not Assigned(Fa) then if not Assigned(Fa) then
WriteLn('FCopy: could not open ', A, ' for reading') WriteLn('!!! FCopy: could not open ', A, ' for reading')
else else
if not Assigned(Fb) then if not Assigned(Fb) then
WriteLn('FCopy: could not open ', B, ' for writing') WriteLn('!!! FCopy: could not open ', B, ' for writing')
else else
Writeln('FCopy: error while copying', LineEnding, Writeln('!!! FCopy: error while copying', LineEnding,
' file ', A, LineEnding, ' to ', B); ' file ', A, LineEnding, ' to ', B);
end; end;
if Assigned(Fa) then Fa.Free; if Assigned(Fa) then Fa.Free;
Expand Down Expand Up @@ -74,44 +80,58 @@ function FDelete(D: String): Boolean;
RmDir(D); RmDir(D);
except except
Result := False; Result := False;
WriteLn('FDelete: could not delete directory: ', D); WriteLn('!!! FDelete: could not delete directory: ', D);
end; end;
end end
else begin else begin
if FileExists(D) then begin if FileExists(D) then begin
if not DeleteFile(D) then begin if not DeleteFile(D) then begin
Result := False; Result := False;
WriteLn('FDelete: could not delete file: ', D); WriteLn('!!! FDelete: could not delete file: ', D);
end; end;
end; end;
end; end;
end; end;


{$ifdef windows} function FTar(A: String; F: array of AnsiString): String;
function FZip(A: String; F: array of AnsiString): Boolean; var
Args: Array of AnsiString;
I: Integer;
begin begin
A := A + '.tar.bz2';
WriteLn('create ', A);
SetLength(Args, Length(F) + 2);
Args[0] := '-cjf';
Args[1] := A;
for I := 0 to Length(F) - 1 do begin
writeln(' add ', F[i]);
Args[i+2] := F[i];
end;
if ExecuteProcess(TAR_EXE, Args) = 0 then
Result := A
else
Result := '';
end; end;
{$else}
function FZip(A: String; F: array of AnsiString): String; function FZip(A: String; F: array of AnsiString): String;
var var
Args: Array of AnsiString; Args: Array of AnsiString;
I: Integer; I: Integer;
begin begin
A := A + '.tar.bz2'; A := A + '.zip';
WriteLn('create ', A); WriteLn('create ', A);
SetLength(Args, Length(F) + 2); SetLength(Args, Length(F) + 2);
Args[0] := '-cjf'; Args[0] := '-r';
Args[1] := A; Args[1] := A;
for I := 0 to Length(F) - 1 do begin for I := 0 to Length(F) - 1 do begin
writeln(' add ', F[i]); writeln(' add ', F[i]);
Args[i+2] := F[i]; Args[i+2] := F[i];
end; end;
if ExecuteProcess('/bin/tar', Args) = 0 then if ExecuteProcess(ZIP_EXE, Args) = 0 then
Result := A Result := A
else else
Result := ''; Result := '';
end; end;
{$endif}


function FRename(A, B: String): Boolean; function FRename(A, B: String): Boolean;
begin begin
Expand Down
2 changes: 1 addition & 1 deletion src/tools/makezip.lpi
Expand Up @@ -53,7 +53,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../client;../client/lnet-0.6.5"/> <OtherUnitFiles Value="../core"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <CodeGeneration>
Expand Down
24 changes: 20 additions & 4 deletions src/tools/makezip.lpr
Expand Up @@ -11,18 +11,34 @@
const const
BINDIR = '../../bin/'; BINDIR = '../../bin/';
ZIPDIR = 'libpurpletorchat/'; ZIPDIR = 'libpurpletorchat/';
LIBNAME = 'libpurpletorchat.so'; LIBNAME_LINUX = 'libpurpletorchat.so';
LIBNAME_WIN32 = 'purpletorchat.dll';


var var
ZipName: String; ZipName: String;


begin begin
ZipName := 'libpurpletorchat-' + SOFTWARE_VERSION + '-linux-i368';
FDelete(ZIPDIR); FDelete(ZIPDIR);

// this assumes that the binaries have ben built already
// and are in the bin folder

WriteLn;
WriteLn('*** making linux archive');
FMkDir(ZIPDIR); FMkDir(ZIPDIR);
FCopy(BINDIR + LIBNAME_LINUX, ZIPDIR);
FCopy('readme_plugin_lin.txt', ConcatPaths([ZIPDIR, 'README.txt']));
ZipName := 'libpurpletorchat-' + SOFTWARE_VERSION + '-linux-i368';
ZipName := FTar(ZipName, [ZIPDIR]);
FRename(ZipName, ConcatPaths([BINDIR, ZipName]));
FDelete(ZIPDIR);


FCopy(BINDIR + LIBNAME, ZIPDIR); WriteLn;
FCopy('readme_plugin.txt', ConcatPaths([ZIPDIR, 'README.txt'])); WriteLn('*** making windows archive');
FMkDir(ZIPDIR);
FCopy(BINDIR + LIBNAME_WIN32, ZIPDIR);
FCopy('readme_plugin_win.txt', ConcatPaths([ZIPDIR, 'README.txt']));
ZipName := 'purpletorchat-' + SOFTWARE_VERSION + '-win32';
ZipName := FZip(ZipName, [ZIPDIR]); ZipName := FZip(ZipName, [ZIPDIR]);
FRename(ZipName, ConcatPaths([BINDIR, ZipName])); FRename(ZipName, ConcatPaths([BINDIR, ZipName]));
FDelete(ZIPDIR); FDelete(ZIPDIR);
Expand Down
Expand Up @@ -13,7 +13,7 @@ libpurpletorchat.so
You also must have tor installed in /usr/sbin/tor which should You also must have tor installed in /usr/sbin/tor which should
normally be the default location of tor if are on a debian based system. normally be the default location of tor if are on a debian based system.


Now start pidgin from within a console window. You should see a lot of Now start pidgin from within a console window. You should see some
debugging output. Additionally there will be a file ~/purpletorchat.log debugging output. Additionally there will be a file ~/purpletorchat.log
which contains the same debug output. which contains the same debug output.


Expand All @@ -28,5 +28,4 @@ apart with a human readable name. It will create a config folder
many accounts (profiles) as you want and use them all simultanously. many accounts (profiles) as you want and use them all simultanously.


This early alpha version of the plugin does only support instant This early alpha version of the plugin does only support instant
messaging and NONE of the other features like file transfer, profile messaging and no file transfer, this will be implemented in later versions.
texts, etc., these will all be implemented in later versions.
37 changes: 37 additions & 0 deletions src/tools/readme_plugin_win.txt
@@ -0,0 +1,37 @@
libpurpletorchat.so
===================

Put this .dll file into the plugin folder of libpurple which is

%APPDATA%\.purple\plugins\
(you might have to create this folder first)

or *alternatively* (not recommended) you may put it to the other
plugin dlls in the Pidgin program folder instead (you will need admin
rights for this):

%ProgramFiles%\Pidgin\plugins\

You also must have Tor installed in the usual location, this must
be the following folder (this is where the offical Tor installer
will install Tor.exe):

%ProgramFiles%\Tor\

Now start pidgin from within a console window. You should see some
debugging output. You may also start it from the start menu because it
will also create a file %APPDATA%\purpletorchat.log which contains the
same debug output.

*** note that this is the debug version of the plugin, the
final release version will not create a debug file. ***

Create a new account, select "TorChat" for the protocol and when asked
for a username just enter your name (or anything else), this is NOT the
TorChat ID, its just an account name to tell different TorChat profiles
apart with a human readable name. It will create a config folder
%APPDATA%\torchat2_accountname\ for each account (profile). You can create
as many accounts (profiles) as you want and use them all simultanously.

This early alpha version of the plugin does only support instant
messaging and no file transfer, this will be implemented in later versions.
Binary file added src/tools/z.zip
Binary file not shown.

0 comments on commit 50f3c8d

Please sign in to comment.