Skip to content

Commit

Permalink
Store library files directly in Resources ordner so that Windows can …
Browse files Browse the repository at this point in the history
…find them
  • Loading branch information
Tebbe Ubben committed Jul 8, 2024
1 parent 8f6310f commit 102984a
Show file tree
Hide file tree
Showing 57 changed files with 203 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ receiving
update

| event |

event := self client receive: 0.05.
"Short pause to make image more responsive, see https://github.com/hpi-swa-teaching/TelegramClient/pull/412#issuecomment-868465126"
event ifNil: [5 milliSeconds wait].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"stickerStore" : "JK 5/16/2024 21:25",
"stickerStore:" : "JK 5/16/2024 21:25",
"tryHandleError:" : "aka 5/21/2022 12:07",
"update" : "JK 5/16/2024 21:57",
"update" : "TU 6/28/2024 03:18",
"userStore" : "per 7/15/2021 12:56",
"userStore:" : "tr 7/25/2021 17:57",
"videoStore" : "JK 6/12/2024 19:42",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
doesLibraryExist

^ self libraryFile exists
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
downloadAllDependencies

self libs do: [ :lib | lib downloadArchiveIfNotExists ]
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
helper
as yet unclassified
downloadArchive

| intermediatePath archive response |
intermediatePath := FileDirectory default / 'archive.zip'.
intermediatePath := FileDirectory default / (self fileName, '.zip').
intermediatePath exists ifTrue: [intermediatePath delete].
FileStream fileNamed: intermediatePath fullName do: [:stream |
response := WebClient httpGet: self downloadUrl.
stream
binary;
nextPutAll: response content.
intermediatePath := FileDirectory default / 'archive.zip'.].
nextPutAll: response content.].
intermediatePath := FileDirectory default / (self fileName, '.zip').
archive := ZipArchive new readFrom: intermediatePath fullName.
archive extractAllTo: FileDirectory default.
archive extractAllTo: FileDirectory default informing: nil overwrite: true.
archive close.
intermediatePath delete.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
downloadArchiveIfNotExists

self doesLibraryExist ifFalse: [self downloadArchive]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
downloadUrl
"URL of the ZIP archive that contains the shared library and its dependencies. All files should be placed at the root of the archive. The main library should have the name that is returned by sending the message 'fileName' + the platform specific file extension. Any other dependencies should be named in a way that the linker can find them."

^ Smalltalk platformName caseOf: {
['Win32'] -> [self windowsDownloadUrl].
['Mac OS'] -> [self macDownloadUrl].
['unix'] -> [self linuxDownloadUrl]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
as yet unclassified
fileEnding

^ Smalltalk platformName caseOf: {
['Win32'] -> ['dll'].
['Mac OS'] -> ['dylib'].
['unix'] -> ['so']}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
fileName
"File name of the main library (without version and file extension)."

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
libraryFile

^ (FileDirectory default / (self fileName, '-', self versionName , '.', self fileEnding))
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
libs

| list |
list := OrderedCollection new.
list add: TCCLibWebP.
list add: TCCFFIClient.
^ list
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
linuxDownloadUrl

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
macDownloadUrl

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
moduleName

^ (FileDirectory default / (self fileName, '-', self versionName , '.', self fileEnding)) fullName
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
mustDownloadDependencies

self libs do: [ :lib | lib doesLibraryExist ifFalse: [ ^true ] ].
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
versionName
"Version of the library. Can be an arbitrary string but must not be an illegal file name since it is used to determine where to store the library files. Change this when updating the dependency, so that the new archive is downladed."

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
windowsDownloadUrl

^ self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"class" : {
"doesLibraryExist" : "TU 7/8/2024 16:30",
"downloadAllDependencies" : "TU 7/3/2024 15:29",
"downloadArchive" : "TU 7/8/2024 16:39",
"downloadArchiveIfNotExists" : "TU 7/3/2024 15:29",
"downloadUrl" : "TU 7/8/2024 16:34",
"fileEnding" : "TU 6/28/2024 02:45",
"fileName" : "TU 7/8/2024 16:30",
"libraryFile" : "TU 7/8/2024 16:30",
"libs" : "TU 7/3/2024 15:27",
"linuxDownloadUrl" : "TU 7/8/2024 16:33",
"macDownloadUrl" : "TU 7/8/2024 16:33",
"moduleName" : "TU 7/8/2024 16:29",
"mustDownloadDependencies" : "TU 7/3/2024 15:19",
"versionName" : "TU 6/28/2024 03:28",
"windowsDownloadUrl" : "TU 7/8/2024 16:33" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "TelegramClient-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "TCCExternalLibrary",
"pools" : [
],
"super" : "ExternalLibrary",
"type" : "normal" }

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
fileName

^ 'libtdjson'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
linuxDownloadUrl

^ 'https://github.com/TebbeUbben/tdlib/releases/download/1.8.0/tdlib-1.8.0-linux.zip'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
macDownloadUrl

^ 'https://github.com/TebbeUbben/tdlib/releases/download/1.8.0/tdlib-1.8.0-mac.zip'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
versionName

^ '1.8.0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
windowsDownloadUrl

^ 'https://github.com/TebbeUbben/tdlib/releases/download/1.8.0/tdlib-1.8.0-windows.zip'
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"class" : {
"downloadUrl" : "r.s 7/13/2020 17:05",
"libraryFilePath" : "rgw 7/16/2022 17:57",
"moduleName" : "rgw 7/16/2022 17:58",
"fileName" : "TU 6/28/2024 03:05",
"linuxDownloadUrl" : "TU 7/8/2024 16:44",
"macDownloadUrl" : "TU 7/8/2024 16:44",
"newForCurrentOs" : "pk 8/5/2021 17:09",
"tdlibVersion" : "rgw 7/16/2022 17:36" },
"tdlibVersion" : "rgw 7/16/2022 17:36",
"versionName" : "TU 6/28/2024 03:05",
"windowsDownloadUrl" : "TU 7/8/2024 16:44" },
"instance" : {
"create" : "js 6/13/2020 12:53",
"free:" : "js 6/13/2020 18:33",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"name" : "TCCFFIClient",
"pools" : [
],
"super" : "ExternalLibrary",
"super" : "TCCExternalLibrary",
"type" : "normal" }
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ decode: aByteArray
dimensions := self getFileInfo: aByteArray.
dimensions ifNil: [ ^nil ].
decodedImage := ByteArray new: (dimensions x) * (dimensions y) * 4.
result := self WebPDecodeBGRAInto: aByteArray dataSize: aByteArray size outputBuffer: decodedImage outputBufferSize: decodedImage size outputStride: dimensions x * 4.
result := self new WebPDecodeBGRAInto: aByteArray dataSize: aByteArray size outputBuffer: decodedImage outputBufferSize: decodedImage size outputStride: dimensions x * 4.
(result isNull) ifFalse: [ ^ self formFrom: decodedImage dimensions: dimensions ].
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
fileName

^ 'libwebp'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ getFileInfo: aByteArray

widthHandle := ExternalType long allocate.
heightHandle := ExternalType long allocate.
result := TCCLibWebP WebPGetInfo: aByteArray dataSize: aByteArray size width: widthHandle height: heightHandle.
result := self new WebPGetInfo: aByteArray dataSize: aByteArray size width: widthHandle height: heightHandle.
(result = 1)
ifTrue: [^ (widthHandle at: 1)@(heightHandle at: 1)]
ifFalse: [ ^ nil ]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
as yet unclassified
instance

instance ifNil: [ instance := super basicNew initialize ].
^ instance
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
linuxDownloadUrl

^ 'https://github.com/TebbeUbben/libwebp/releases/download/1.4.0/libwebp-1.4.0-linux.zip'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
macDownloadUrl

^ 'https://github.com/TebbeUbben/libwebp/releases/download/1.4.0/libwebp-1.4.0-mac.zip'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
resetInstance

instance := nil.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
versionName

^ '1.4.0'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
windowsDownloadUrl

^ 'https://github.com/TebbeUbben/libwebp/releases/download/1.4.0/libwebp-1.4.0-windows.zip'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
WebPDecodeBGRAInto: aPointer1 dataSize: aNumber1 outputBuffer: aPointer2 outputBufferSize: aNumber2 outputStride: aNumber3
<cdecl: uint8_t* 'WebPDecodeBGRAInto'(uint8_t*, size_t, uint8_t*, size_t, long) module: 'libwebp'>
<cdecl: uint8_t* 'WebPDecodeBGRAInto'(uint8_t*, size_t, uint8_t*, size_t, long)>
^self externalCallFailed
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
WebPGetInfo: aPointer1 dataSize: aNumber width: aPointer2 height: aPointer3
<cdecl: long 'WebPGetInfo'(uint8_t*, size_t, long*, long*) module: 'libwebp'>
<cdecl: long 'WebPGetInfo'(uint8_t*, size_t, long*, long*)>
^self externalCallFailed
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"class" : {
"WebPDecodeBGRAInto:dataSize:outputBuffer:outputBufferSize:outputStride:" : "TU 5/18/2024 15:20",
"WebPGetInfo:dataSize:width:height:" : "TU 5/18/2024 01:44",
"decode:" : "TU 5/22/2024 19:22",
"decode:" : "TU 7/3/2024 16:05",
"fileName" : "TU 6/28/2024 02:40",
"formFrom:dimensions:" : "TU 5/22/2024 19:21",
"getFileInfo:" : "TU 5/29/2024 15:05" },
"getFileInfo:" : "TU 7/3/2024 16:05",
"instance" : "TU 7/3/2024 16:03",
"linuxDownloadUrl" : "TU 7/8/2024 16:35",
"macDownloadUrl" : "TU 7/8/2024 16:35",
"resetInstance" : "TU 7/3/2024 16:04",
"versionName" : "TU 6/28/2024 02:40",
"windowsDownloadUrl" : "TU 7/8/2024 16:35" },
"instance" : {
} }
"WebPDecodeBGRAInto:dataSize:outputBuffer:outputBufferSize:outputStride:" : "TU 7/3/2024 15:46",
"WebPGetInfo:dataSize:width:height:" : "TU 7/3/2024 15:46" } }
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"category" : "TelegramClient-Core",
"classinstvars" : [
],
"instance" ],
"classvars" : [
],
"commentStamp" : "",
Expand All @@ -10,5 +10,5 @@
"name" : "TCCLibWebP",
"pools" : [
],
"super" : "Object",
"super" : "TCCExternalLibrary",
"type" : "normal" }

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"class" : {
"downloadUrl" : "rgw 7/16/2022 17:40",
"libraryFilePath" : "rgw 7/16/2022 17:57" },
},
"instance" : {
"type" : "r.s 7/13/2020 17:31" } }

This file was deleted.

This file was deleted.

Loading

0 comments on commit 102984a

Please sign in to comment.