Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
3ab46139
Commit
3ab46139
authored
7 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Mantis-1474: try to remove system locations in OTB package
parent
9b577891
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Packaging/post_install.cmake
+53
-0
53 additions, 0 deletions
Packaging/post_install.cmake
with
53 additions
and
0 deletions
Packaging/post_install.cmake
+
53
−
0
View file @
3ab46139
...
...
@@ -18,6 +18,56 @@
# limitations under the License.
#
function
(
sanitize_system_paths
)
cmake_parse_arguments
(
SANITIZE
""
"SOURCE"
""
${
ARGN
}
)
# does not support Windows ...
if
(
APPLE
)
set
(
SHARED_EXT
"
\\
.dylib"
)
elseif
(
UNIX
)
set
(
SHARED_EXT
"
\\
.so"
)
endif
()
set
(
filtered_content
)
file
(
STRINGS
"
${
SANITIZE_SOURCE
}
"
source_file_content NEWLINE_CONSUME
)
string
(
REGEX REPLACE
"
\n
"
"
\n
;"
source_file_content
"
${
source_file_content
}
"
)
set
(
SEARCH_REGEX
"(^[^#
\"
]+(LIBRARIES|INCLUDE_DIR[A-Z]*) +
\"
)(.+)(
\"
[^
\"
]*)"
)
foreach
(
line
${
source_file_content
}
)
set
(
filtered_line
"
${
line
}
"
)
if
(
line MATCHES
"
${
SEARCH_REGEX
}
"
)
string
(
REGEX REPLACE
"
${
SEARCH_REGEX
}
"
"
\\
3"
extract_str
"
${
line
}
"
)
string
(
REGEX REPLACE
";;"
";"
extract_str
"
${
extract_str
}
"
)
set
(
_to_be_removed
)
set
(
_to_be_added
)
foreach
(
path
${
extract_str
}
)
if
(
IS_ABSOLUTE
${
path
}
)
list
(
APPEND _to_be_removed
"
${
path
}
"
)
if
(
NOT IS_DIRECTORY
${
path
}
)
if
(
path MATCHES
"^.*/lib[^
\\
.]+
${
SHARED_EXT
}
.*"
)
string
(
REGEX REPLACE
"^.*/lib([^
\\
.]+)
${
SHARED_EXT
}
.*"
"
\\
1"
_lib_name
"
${
path
}
"
)
list
(
APPEND _to_be_added
"
${
_lib_name
}
"
)
endif
()
endif
()
endif
()
endforeach
()
if
(
_to_be_removed
)
list
(
REMOVE_ITEM extract_str
${
_to_be_removed
}
)
endif
()
if
(
_to_be_added
)
list
(
INSERT extract_str 0
${
_to_be_added
}
)
endif
()
if
(
extract_str
)
list
(
REMOVE_DUPLICATES extract_str
)
endif
()
string
(
REGEX REPLACE
"
${
SEARCH_REGEX
}
"
"
\\
1
${
extract_str
}
\\
4"
filtered_line
"
${
line
}
"
)
endif
()
list
(
APPEND filtered_content
"
${
filtered_line
}
"
)
endforeach
()
string
(
REGEX REPLACE
"
\n
;"
"
\n
"
filtered_content
"
${
filtered_content
}
"
)
file
(
WRITE
"
${
SANITIZE_SOURCE
}
"
"
${
filtered_content
}
"
)
endfunction
()
#check variables are set
foreach
(
var P_DIRS P_MATCH P_REPLACE
)
if
(
NOT
${
var
}
)
...
...
@@ -42,5 +92,8 @@ foreach( p_dir ${P_DIRS} )
file
(
WRITE
"
${
cmake_file
}
"
"# This file is modified by OTB after installation.
\n
${
cmake_file_CONTENTS
}
"
)
endif
()
if
(
UNIX
)
sanitize_system_paths
(
SOURCE
${
cmake_file
}
)
endif
()
endforeach
()
# foreach( cmake_file
endforeach
()
# foreach( p_dir
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment