Skip to content

Commit

Permalink
Fix the new paths to dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Vasseur committed Jun 23, 2024
1 parent 008b60d commit c5e6175
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
12 changes: 0 additions & 12 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,9 @@ $(OBJECTS): %$(OBJEXT): %.c %.h
clean-l:
rm -f $(OBJECTS)

# Change baseDir in composer autogenerated files
define fix_composer_paths
for file in autoload_psr4.php autoload_classmap.php autoload_files.php autoload_namespaces.php ; do \
sed -i "s#^\$$baseDir = .*#\$$baseDir = dirname('$(domserver_webappdir)');#" $(1)/composer/$$file ; \
done
sed -i "s#__DIR__ \. '/\.\./\.\./\.\.' \. '/webapp#'$(domserver_webappdir)#" $(1)/composer/autoload_static.php
endef

install-domserver:
$(INSTALL_DATA) -t $(DESTDIR)$(domserver_libdir) *.php
$(INSTALL_PROG) -t $(DESTDIR)$(domserver_libdir) alert
for i in vendor/* ; do \
$(call install_tree,$(DESTDIR)$(domserver_libvendordir),$$i) ; \
done
$(call fix_composer_paths,$(DESTDIR)$(domserver_libvendordir))

install-judgehost:
$(INSTALL_DATA) -t $(DESTDIR)$(judgehost_libdir) *.php *.sh
Expand Down
17 changes: 13 additions & 4 deletions webapp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,36 @@ copy-bundle-assets:
# the include paths are broken. We just copy in the data we need
-rm -rf public/bundles/nelmioapidoc
mkdir -p public/bundles/nelmioapidoc
cp -R ../lib/vendor/nelmio/api-doc-bundle/Resources/public/* public/bundles/nelmioapidoc/
cp -R ../webapp/vendor/nelmio/api-doc-bundle/Resources/public/* public/bundles/nelmioapidoc/

clean-l:
-rm -rf public/bundles/nelmioapidoc

# Change baseDir in composer autogenerated files
define fix_composer_paths
for file in autoload_psr4.php autoload_classmap.php autoload_files.php autoload_namespaces.php ; do \
sed -i "s#^\$$baseDir = .*#\$$baseDir = dirname('$(domserver_webappdir)');#" $(1)/composer/$$file ; \
done
sed -i "s#__DIR__ \. '/\.\./\.\./\.\.' \. '/webapp#'$(domserver_webappdir)#" $(1)/composer/autoload_static.php
endef

install-domserver:
# This must be done first to install with the rest.
$(MAKE) copy-bundle-assets
$(INSTALL_DIR) $(DESTDIR)$(domserver_webappdir);
for d in bin config migrations public resources src templates tests ; do \
for d in bin config migrations public resources src templates tests vendor; do \
$(call install_tree,$(DESTDIR)$(domserver_webappdir),$$d) ; \
done
$(call fix_composer_paths,$(DESTDIR)$(domserver_webappdir)/vendor)
# Change webapp/public/doc symlink
rm $(DESTDIR)$(domserver_webappdir)/public/doc
ln -s $(domjudge_docdir) $(DESTDIR)$(domserver_webappdir)/public/doc
# Now change all relative symlinks in webapp/public to their correct paths
for link in $$(find $(DESTDIR)$(domserver_webappdir)/public/$$dir -maxdepth 2 -type l); do \
target=$$(readlink $$link) ; \
if echo $${target} | grep -q '\.\./\.\./lib/vendor' ; then \
if echo $${target} | grep -q '\.\./\.\./webapp/vendor' ; then \
rm $$link ; \
realtarget=$(domserver_libvendordir)$$(echo $${target} | sed 's!^.*\.\./\.\./lib/vendor!!') ; \
realtarget=$(domserver_webappdir)/vendor$$(echo $${target} | sed 's!^.*\.\./\.\./webapp/vendor!!') ; \
ln -s $$realtarget $$link ; \
fi \
done
Expand Down

0 comments on commit c5e6175

Please sign in to comment.