File: adapt_csprog_to_build_on_linux.patch

package info (click to toggle)
keepass2-plugin-keepassrpc 2.0.2%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,304 kB
  • sloc: cs: 29,001; makefile: 16
file content (98 lines) | stat: -rw-r--r-- 3,637 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From: Fab Stz <fabstz-it@yahoo.fr>
Date: Wed, 20 Mar 2024 19:49:43 +0100
Subject: Adapt KeePassRPC.csproj for build on linux

Origin: self
Forwarded: not-needed
Last-Update: 2024-03-20
---
 KeePassRPC/KeePassRPC.csproj | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/KeePassRPC/KeePassRPC.csproj b/KeePassRPC/KeePassRPC.csproj
index a3f0812..97c2125 100644
--- a/KeePassRPC/KeePassRPC.csproj
+++ b/KeePassRPC/KeePassRPC.csproj
@@ -114,6 +114,7 @@
     <Reference Include="KeePass">
       <HintPath Condition="'$(OS)' == 'Windows_NT'">$(USERPROFILE)\KeePassDEV\KeePass.exe</HintPath>
       <HintPath Condition="'$(OS)' != 'Windows_NT'">$(home)/keepass-dev/KeePass.exe</HintPath>
+      <HintPath Condition="'$(OS)' != 'Windows_NT'">/usr/lib/keepass2/KeePass.exe</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
@@ -479,12 +480,18 @@
   <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
     <PostBuildEvent>
       #!/bin/bash
+      #set -ex
       echo POSTBUILDSTEP for $(ProjectName)
 
+      # Run all cp command with -a argument
+      cp() { command cp -a "$@"; }
+
       export KPDir="${HOME}/keepass-dev/"
-      export KPPDir=${KPDir}Plugins/
+      export KPPDir=${PWD}/Plugins/
       export KPPTempDir="${KPPDir}$(ProjectName)"
             
+      mkdir -p "${KPPTempDir}"
+
       # delete the PLGX from any previous ReleasePLGX build
       rm -f "${KPPDir}$(ProjectName).plgx"
       if [ $? = 1 ]; then echo POSTBUILDSTEP for $(ProjectName) FAILED; exit 1; fi
@@ -492,7 +499,7 @@
 
       # copy output DLLs to KeePass plugins directory
       cp "$(ProjectName).dll" "${KPPDir}$(ProjectName).dll"
-      cp "$(ProjectName).pdb" "${KPPDir}$(ProjectName).pdb"
+      if [ -f "$(ProjectName).pdb" ]; then cp "$(ProjectName).pdb" "${KPPDir}$(ProjectName).pdb"; fi
       
       if [ $? = 1 ]; then echo POSTBUILDSTEP for $(ProjectName) FAILED; exit 1; fi
             
@@ -510,10 +517,14 @@
   <PropertyGroup Condition="'$(OS)' != 'Windows_NT' AND '$(ConfigurationName)' == 'ReleasePLGX'">
     <PostBuildEvent>
       #!/bin/bash
+      #set -ex
       echo POSTBUILDSTEP for $(ProjectName)
 
+      # Run all cp command with -a argument
+      cp() { command cp -a "$@"; }
+
       export KPDir="${HOME}/keepass-dev/"
-      export KPPDir=${KPDir}Plugins/
+      export KPPDir=${PWD}/Plugins/
       export KPPTempDir="${KPPDir}$(ProjectName)"
 
       echo KPDir: ${KPDir}
@@ -530,7 +541,7 @@
       
       # create temporary directory
       rm -rf "${KPPTempDir}"
-      mkdir "${KPPTempDir}"
+      mkdir -p "${KPPTempDir}"
       if [ $? = 1 ]; then echo POSTBUILDSTEP for $(ProjectName) FAILED - prep temp dir; exit 1; fi
       echo Temporary directory created
       
@@ -581,7 +592,12 @@
       echo Files copied to temporary directory
 
       # create the PLGX
-      "${KPDir}KeePass.exe" --plgx-create "${KPPTempDir}" --plgx-prereq-kp:2.48
+      # Attempt to achieve reproducible build, but not sufficient:
+      # See also https://sourceforge.net/p/keepass/feature-requests/2872/
+      # find ${KPPTempDir} -exec touch -d @$SOURCE_DATE_EPOCH '{}' "%3B"
+      # touch -d @$SOURCE_DATE_EPOCH ${KPPTempDir}/*.dll
+      # faketime @$SOURCE_DATE_EPOCH keepass2 ...
+      keepass2 --plgx-create "${KPPTempDir}" --plgx-prereq-kp:2.48
       if [ $? = 1 ]; then echo POSTBUILDSTEP for $(ProjectName) FAILED - create PLGX; exit 1; fi
       echo PLGX created
 
@@ -591,4 +607,4 @@
             
       echo POSTBUILDSTEP for $(ProjectName) COMPLETED OK</PostBuildEvent>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>