Skip to contentSkip to conversation

freetype: fix double installation

PATCH New Thomas Petazzoni 3 participants 3 messages Jul 3, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 freetype: fix double installation

Eric_L on IRC reported that the following strange behavior: the first installation of freetype works, and then each time you do "make freetype-dirclean freetype", it fails and works alternatively, in a fully reproducible manner.

After some investigation, it turns out that the problem is caused by the creation of the symbolic link /usr/include/freetype2/freetype -> /usr/include/freetype2 for backward compatibility reasons by freetype.mk, in a post-staging installation hook. As the symbolic link is created *after* the installation, the first installation works fine. However, the second installation fails because the freetype build system does:

./builds/unix/mkinstalldirs \
/home/thomas/projets/buildroot/output/target/usr/include/freetype2/config
[...]
rm -f /home/thomas/projets/buildroot/output/target/usr/include/freetype2/freetype/config/* rmdir /home/thomas/projets/buildroot/output/target/usr/include/freetype2/freetype/config
[...]
/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h \
/home/thomas/projets/buildroot/output/target/usr/include/freetype2/config/ftconfig.h

This last line fails, because due to the symbolic link mentioned above, the command 'rmdir /home/thomas/projets/buildroot/output/target/usr/include/freetype2/freetype/config' has in fact the consequence of deleting the 'config' directory created by the mkinstalldirs command.

The proposed solution to solve this problem is to remove the symbolic in a pre-install hook, run the installation, and restore the symbolic link.

---
 package/freetype/freetype.mk | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
package/freetype/freetype.mk +16 -2
index a6ae0a0..b267806 100644
@@ -70,12 +70,26 @@ define FREETYPE_FIX_CONFIG_FILE_LIBS
 endef
 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE_LIBS
 
-# Version 2.5.1 reorganized headers out of freetype2/freetype
-# It's unexpected for some packages so symlink it until it spreads upstream
+# Version 2.5.1 reorganized headers out of freetype2/freetype It's
+# unexpected for some packages so symlink it until it spreads
+# upstream. Note that we also have to remove the symlink prior to the
+# installation process, because the installation process of freetype
+# removes usr/include/Freetype2/freetype/config, before installing
+# something in usr/include/Freetype2/config/ which no longer exists
+# due to the symbolic link.
+define FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
+	$(RM) -f $(STAGING_DIR)/usr/include/freetype2/freetype
+endef
+FREETYPE_PRE_INSTALL_STAGING_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
 define FREETYPE_FIX_FREETYPE_INCLUDE
 	ln -sf . $(STAGING_DIR)/usr/include/freetype2/freetype
 endef
 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_FREETYPE_INCLUDE
+
+define HOST_FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
+	$(RM) -f $(HOST_DIR)/usr/include/freetype2/freetype
+endef
+HOST_FREETYPE_PRE_INSTALL_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
 define HOST_FREETYPE_FIX_FREETYPE_INCLUDE
 	ln -sf . $(HOST_DIR)/usr/include/freetype2/freetype
 endef
Signature · 1 line
2.0.0
#1 lore raw

PATCH 1/1 freetype: fix double installation

Thomas, All,

On 2014-07-03 22:19 +0200, Thomas Petazzoni spake thusly:
[--SNIP--]

Quoted 5 lines

The proposed solution to solve this problem is to remove the symbolic in a pre-install hook, run the installation, and restore the symbolic link.

Regards,
Yann E. MORIN.

Quoted 44 lines
---
 package/freetype/freetype.mk | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
package/freetype/freetype.mk +16 -2
index a6ae0a0..b267806 100644
@@ -70,12 +70,26 @@ define FREETYPE_FIX_CONFIG_FILE_LIBS
 endef
 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_CONFIG_FILE_LIBS
 
-# Version 2.5.1 reorganized headers out of freetype2/freetype
-# It's unexpected for some packages so symlink it until it spreads upstream
+# Version 2.5.1 reorganized headers out of freetype2/freetype It's
+# unexpected for some packages so symlink it until it spreads
+# upstream. Note that we also have to remove the symlink prior to the
+# installation process, because the installation process of freetype
+# removes usr/include/Freetype2/freetype/config, before installing
+# something in usr/include/Freetype2/config/ which no longer exists
+# due to the symbolic link.
+define FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
+	$(RM) -f $(STAGING_DIR)/usr/include/freetype2/freetype
+endef
+FREETYPE_PRE_INSTALL_STAGING_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
 define FREETYPE_FIX_FREETYPE_INCLUDE
 	ln -sf . $(STAGING_DIR)/usr/include/freetype2/freetype
 endef
 FREETYPE_POST_INSTALL_STAGING_HOOKS += FREETYPE_FIX_FREETYPE_INCLUDE
+
+define HOST_FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
+	$(RM) -f $(HOST_DIR)/usr/include/freetype2/freetype
+endef
+HOST_FREETYPE_PRE_INSTALL_HOOKS += FREETYPE_REMOVE_FREETYPE_INCLUDE_SYMLINK
 define HOST_FREETYPE_FIX_FREETYPE_INCLUDE
 	ln -sf . $(HOST_DIR)/usr/include/freetype2/freetype
 endef
Signature · 6 lines
2.0.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 freetype: fix double installation

In reply to Thomas Petazzoni
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Eric_L on IRC reported that the following strange behavior: the first installation of freetype works, and then each time you do "make freetype-dirclean freetype", it fails and works alternatively, in a fully reproducible manner.

[snip]

Quoted 2 lines

The proposed solution to solve this problem is to remove the symbolic in a pre-install hook, run the installation, and restore the symbolic

s/in/link in/

package/freetype/freetype.mk define FREETYPE_FIX_CONFIG_FILE_LIBS · line 73

Quoted 3 lines
package/freetype/freetype.mk +1 -2
-# Version 2.5.1 reorganized headers out of freetype2/freetype
-# It's unexpected for some packages so symlink it until it spreads upstream
+# Version 2.5.1 reorganized headers out of freetype2/freetype It's

A '.' and/or newline is missing before "It's".

Committed with these minor tweaks, thanks.

Signature · 1 line
Bye, Peter Korsgaard