Say a wizard wishes to have his ship able to repair itself mid-combat. Were he to have multiple glyphs of warding storing the Fabricate spell cast on the hull of his ship, alongside sufficient spare planks of wood and other materials, and specifies the hull as a surface, would the spell break as soon as the ship sets sail?
Fabricate cannot be stored in glyph of warding
So that part of your question will not work from the get-go.
Glyph of warding (spell glyph) says:
You can store a prepared spell of 3rd level or lower in the glyph by casting it as part of creating the glyph. The spell must target a single creature or an area... If the spell has a target, it targets the creature that triggered the glyph.
However, fabricate is not a valid spell to store with glyph of warding because it targets materials (objects) and not a creature or an area and thus cannot be stored in the glyph.
Choose raw materials that you can see within range...
But assuming you chose a different spell, I'll answer the core of your question.
It depends on how your DM defines your location
Glyph of Warding (as of the post-errata 6th printing)
You inscribe [the glyph] either on a surface either on a surface (such as a table or a section of floor or wall) or within an object that can be closed (such as a book, a scroll, or a treasure chest) to conceal the glyph... If the surface or object is moved more than 10 feet from where you cast this spell, the glyph is broken, and the spell ends without being triggered. (PHB p. 245)
There are no rules guidance for what is considered a location or not. There is a good discussion of it here, but what it really comes down to is a DM decision.
Case 1: Location relative to planet - Yes, spell is broken
In this case "where you cast the spell" would be the spot that you can see on the ground (or wherever you are casting it). Basically think GPS coordinates.
If the ship moved more than 10 feet from the GPS coordinates of where you cast the spell, the spell will be broken.
This is a very straightforward reading, but could possibly prevent usage of the spell on cloud giants' flying castles and other such large significant moving areas. However,
Case 2: Location relative to ship - No, spell is not broken
This reading means that since the ship is the point of reference it can really never be broken because the hull of the ship, barring some terrible failure, should never be more than 10 feet from the ship itself.
This reading is more generous, but could be prone to hijinks in how small that relative motion is defined.
In my games, I generally opt for option #2 in areas that are big enough that PCs normally feel comfortable calling the setting for a scene. So an enormous boat substantial enough for its own map, generally would be considered the frame of reference for the scene whereas a one-person minecart would not.
Just note that there is no reason you have to pick an option and stick with it for every case in every situation. It is a case-by-case, scene-by-scene ruling and the key is to try to go with what feels naturally like the frame of reference for the scene.
I've found that this aligns with players' often subconscious expectations and causes less confusion and friction at the table.
Moving a Ship Shouldn't Break Glyphs of Warding
... but moving a boat probably would.
Although it's a DM call, there is precedence for things like this not being dispelled if cast in a sufficiently large, moving environment like a ship, floating island, iceberg, cloud castle, earthmote, planet, etc.:
- Rise of Tiamat has a moving iceberg dungeon that has glyphs
- DDEP5-02: Ark of the Mountains is a Flying Ship that has glyphs in it
- DDAL06-02 The Redemption of Kelvan has an earthmote with glyphs in it
- Hoard of the Dragon Queen features a moving cloud castle with glyphs in it
- Tomb of Annihilation has a moving earthmote that contains a permanent teleportation circle
It'd be odd if players couldn't cast say, Tiny Hut in such moving adventure environments. Quoting from the accepted answer here:
Rules As Written: There's no specific definition of "stationary" in the game. Depending on your point of view, nothing is stationary, because planets whip through the cosmos at thousands of miles per hour. [...]
Advice: Personally, my ruling is based on mapping: if it's big enough or elaborate enough that a battle can take place on it, then it's big enough to count as a stationary object for spells that require them (like teleportation circles onboard ships).
Sorry, the spell breaks
The version of the spell you're reading is (probably) pre-errata.
5th edition and prior versions of the PHB (and the SRD) say...
When you cast this spell, you inscribe a glyph that harms other creatures, either upon a surface (such as a table or a section of floor or wall) or within an object that can be closed (such as a book, a scroll, or a Treasure chest) to conceal the glyph. If you choose a surface, the glyph can cover an area of the surface no larger than 10 feet in diameter. If you choose an object, that object must remain in its place, if the object is moved more than 10 feet from where you cast this spell, the glyph is broken and the spell ends without being triggered.
This is where the lack of clarity over whether or not a Surface can be moved without breaking a glyph usually comes from.
The sixth printing errata clarifies this...
Glyph of Warding (p. 245).
The first sentence clarifies that the magical effect needn’t be harmful. The final two sentences of the first paragraph now read as follows: “The glyph can cover an area no larger than 10 feet in diameter. If the surface or object is moved more than 10 feet from where you cast this spell, the glyph is broken, and the spell ends without being triggered” (6th printing).
Thus, that block of the spell description should actually read as...
When you cast this spell, you inscribe a glyph that later unleashes a magical effect. You inscribe it either on a surface (such as a table or a section of floor or wall) or within an object that can be closed (such as a book, a scroll, or a treasure chest) to conceal the glyph. The glyph can cover an area no larger than 10 feet in diameter. If the surface or object is moved more than 10 feet from where you cast this spell, the glyph is broken, and the spell ends without being triggered.
So, sorry...soon as your wizard's ship moves, all the glyphs are broken without being triggered.