-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the installation prefix in the pkgConfig file
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var | ||
AppPath: string; | ||
|
||
procedure ReplacePlaceholderInPkgConfig; | ||
var | ||
PkgConfigFile: TStringList; | ||
Index: Integer; | ||
ModifiedAppPath: string; | ||
begin | ||
// Read the contents of the liblite-string.pc file | ||
PkgConfigFile := TStringList.Create; | ||
try | ||
PkgConfigFile.LoadFromFile(ExpandConstant('{app}\lib\pkgconfig\liblite-string.pc')); | ||
|
||
// Modify the installation prefix to match the chosen installation destination | ||
if PkgConfigFile.Count > 0 then | ||
begin | ||
// Replace backslashes with forward slashes | ||
ModifiedAppPath := ''; | ||
for Index := 1 to Length(AppPath) do | ||
begin | ||
if AppPath[Index] = '\' then | ||
ModifiedAppPath := ModifiedAppPath + '/' | ||
else | ||
ModifiedAppPath := ModifiedAppPath + AppPath[Index]; | ||
end; | ||
// Update the prefix | ||
PkgConfigFile[0] := 'prefix = "' + ModifiedAppPath + '"'; | ||
end; | ||
|
||
// Write the modified contents back to the file | ||
PkgConfigFile.SaveToFile(ExpandConstant('{app}\lib\pkgconfig\liblite-string.pc')); | ||
finally | ||
PkgConfigFile.Free; | ||
end; | ||
end; | ||
|
||
// Run after the installation has completed | ||
procedure DeinitializeSetup(); | ||
begin | ||
AppPath := ExpandConstant('{app}'); | ||
ReplacePlaceholderInPkgConfig; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters